Skip to content

Commit 1ffda34

Browse files
committed
Adding 4.1.scm
1 parent 71ac160 commit 1ffda34

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

4.0/4.1.scm

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
;;Write a version of list-of-values that evaluates operands from left to right regardless of the order of evaluation in the underlying Lisp. Also write a version of list-of-values that evaluates operands from right to left.
2+
3+
;; given procedure
4+
(define (list-of-values exps env)
5+
(if (no-operands? exps)
6+
'()
7+
(cons (eval (first-operand exps) env)
8+
(list-of-values (rest-operands exps) env))))
9+
;;
10+
(define (list-of-values exps env)
11+
(let ((rest (list-of-values (rest-operands exps) env)))
12+
(let ((first (first-operand exps)))
13+
(cons (eval first) rest))))
14+
15+
16+
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+

0 commit comments

Comments
 (0)