Alternatively, show how to implement and and or as derived expressions. If test evaluates to a true value, then recipient is evaluated. Modify the handling of cond so that it supports this extended syntax. The bindings and body are just as in ordinary let , except that var is bound within body to a procedure whose body is body and whose parameters are the variables in the bindings. Thus, one can repeatedly execute the body by invoking the procedure named var.
Many languages support a variety of iteration constructs, such as do , for , while , and until .
In Scheme, iterative processes can be expressed in terms of ordinary procedure calls, so special iteration constructs provide no essential gain in computational power. On the other hand, such constructs are often convenient. Design some iteration constructs, give examples of their use, and show how to implement them as derived expressions. By using data abstraction, we were able to write an eval procedure that is independent of the particular syntax of the language to be evaluated. To illustrate this, design and implement a new syntax for Scheme by modifying the procedures in this section, without changing eval or apply .