SICP Exercise 4.10 new syntax for Scheme
Exercise 4.10. 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.
SOLUTION
Here are the syntax changes I made:
SOLUTION
Here are the syntax changes I made:
- Comparison expressions of like (< x y) changed to a more intuitive (x < y). This applies to the following operators: <, >, <=, >= and ==. Note that for equality I have introduced the operator "==". This is because I want to reserve "=" for assignments and definitions
- Assignment syntax changed from (set! x value) to (x = value)
- 'if' syntax changed (see "if" section below)
Comments
Post a Comment