Files
lysp/examples/env.lysp
T

17 lines
479 B
Plaintext

; empty env
(setq custom-env (env/create nil))
(setq
custom-env-expr
'(progn
(defun my-function () 1234)
)
)
(defun my-function () 4321)
(assert (= 'ok (car (eval custom-env custom-env-expr))))
(assert (= 4321 (my-function)))
(assert (= '(ok 1234) (eval custom-env '(my-function))))
(assert (= 'err (car (eval custom-env '(print 1234))))) ;; print is not defined in custom-env
(env/load-prelude custom-env)
(assert (= '(ok nil) (eval custom-env '(print 1234))))