26 lines
630 B
Scheme
26 lines
630 B
Scheme
(load "util.scm")
|
|
(load "misc/evaluator.scm")
|
|
|
|
(display "\nex-4.1 - list-of-values\n")
|
|
|
|
(define (list-of-values-left-to-right exps env)
|
|
(if (no-operands? exps)
|
|
'()
|
|
(let ((first (eval (first-operand exps) env)))
|
|
(let ((rest ((list-of-values (rest-operands exps) env))))
|
|
(cons first rest)))))
|
|
|
|
(define (list-of-values-right-to-left exps env)
|
|
(if (no-operands? exps)
|
|
'()
|
|
(let ((rest ((list-of-values (rest-operands exps) env))))
|
|
(let ((first (eval (first-operand exps) env)))
|
|
(cons first rest)))))
|
|
|
|
(display "[done]\n")
|
|
|
|
(display "\nex-4.2\n")
|
|
|
|
(display "\nex-4.3\n")
|
|
|