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:
  1. 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
  2. Assignment syntax changed from (set! x value) to (x = value)
  3. 'if' syntax changed (see "if" section below)
The code and tests are here.

Comments

Popular posts from this blog

SICP Exercise 2.56 differentiation rule

SICP Exercise 1.28 (Miller-Rabin Test)

SICP Exercise 4.18 a alternative strategy for interpreting internal definitions