<< Previous exercise (4.22)
| Index |
Next exercise (4.24) >>
In Alyssa's analyze-sequence, execute-sequence is running in runtime. But the solution in the text unrolls this procedure. for example: for ((lambda (x) (+ x 1)) 1),
Alyssa's analyze-sequence is (lambda (env) (execute-sequence (lambda ...) env)),
analyze-sequence in text is (lambda (env) ((lambda ...) env)).
This finally seems to be at least a vague reference to interpreters as iterating down a tree structure. It seems pretty clear from comparison that the version of analyze-sequence presented in the text cdrs down *two* branches of a procedure's environment for every run through its "loop" procedure, whereas Alyssa's only cdrs to the end of one possible sequence and executes. Thus its efficiency gains over the original eval grow quadratically with the complexity of the procedure it analyzes.