Force operands to be evaluated from left to right, by using a nested let.

Note that a single let won’t work because (let ((a v1) (b v2))) is just a shortcut for ((lambda (a b) …) v1 v2) and v1 and v2 will use the same order of evaluation as the underlying scheme.

(define (list-of-values exps env)
(if (no-operands? exps)
'()
(let ([left (eval (first-operand exps) env)])
(let ([right (list-of-values (rest-operands exps) env)])
(cons left right)))))

Force right to left evaluation. Remember let* is a shortcut for nested lets which I find nicer to read.

(define (list-of-values exps env)
(if (no-operands? exps)
'()
(let* ([right (list-of-values (rest-operands exps) env)]
([left (eval (first-operand exps) env)]))
(cons left right))))

### Like this:

Like Loading...

*Related*

what if a do a single let in a single right or left