M interpreter.scm => interpreter.scm +3 -3
@@ 44,9 44,9 @@
((assignment? expr)
(let ((tok (assignment-name expr)))
(if (hash-table-exists? global-env (token-lexeme tok))
- (begin
- (hash-table-set! global-env (token-lexeme tok) (assignment-value expr))
- (assignment-value expr))
+ (let ((res (evaluate (assignment-value expr))))
+ (hash-table-set! global-env (token-lexeme tok) res)
+ res)
(runtime-err! (format "Unbound variable ~A at line ~A"
(token-lexeme tok) (token-line tok))))))
((unary? expr)