]> git.rkrishnan.org Git - sicp.git/blob - src/sicp/ex4_2.rkt
Solution to 4.30. Extremely enlightening!
[sicp.git] / src / sicp / ex4_2.rkt
1 #lang racket
2
3 #|
4
5 a. application? only checks whether the given expression is a pair. It assumes that the rest of
6    the built in language clauses are already handled. So this will upset all other clauses like
7    define, let where Louis's eval would think define is a procedure and would proceed to evaluate
8    the operands, which is wrong.
9
10 |#
11
12 #|
13
14 b.
15
16 We only change the selectors and the predicate procedures, everything else remain the same to
17 implement the new proposal.
18
19 |#
20
21 (define (application? exp)
22   (if (pair? exp)
23       (tagged-list? expr 'call)
24       #f))
25
26 (define (operator exp) (car (cdr exp)))
27 (define (operands exp) (cdr (cdr exp)))
28