“cond”,”and” and “or” in Scheme

Imagine you wrote if as a function/procedure rather than a user defined macro/syntax: The problem with my-if is that as a procedure every argument gets evaluated before the procedure body gets executed. thus in atom? the parts (not (pair? x)), #t and #f were evaluated before the body of my-if gets executed. For the last example means (add (- a 1) (+ b 1)) gets evaluated regardless of what a … Read more

How does `let` work in Scheme?

While not exactly the problem you’re experiencing, but an aside based on your questioning about the sequence of evaluating the arguments, let is also “syntactic sugar” for a lambda followed by it’s arguments that are first evaluated and then passed to the lambda which is then evaluated. For instance: is the same as: So, if you’re ever … Read more

What is the best Scheme interpreter or compiler?

For a beginner, I would highly recommend DrRacket (formerly Dr. Scheme), since it gives you a really nice environment to work in, supports many dialects of Scheme, and gives very good failure and debugging information. I believe most implementations of Scheme are interpreters, although it is possible that there is a compiler out there. If you are … Read more