SICP/ex-4_01-xx.scm

26 lines
630 B
Scheme
Raw Normal View History

2021-01-14 13:35:46 +01:00
(load "util.scm")
2021-01-15 20:38:24 +01:00
(load "misc/evaluator.scm")
2021-01-14 13:35:46 +01:00
2021-01-15 20:38:24 +01:00
(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")
2021-01-14 13:35:46 +01:00