Thursday, February 26, 2009

Dynamic Scope in LISP

The following program will print (3 5) in newlisp which is dynamic scoped. But it will print (3 7) in CLISP which is static scoped.

(let ((y 7)) (define (scope-test x) (list x y)))
(let ((y 5)) (scope-test 3))

No comments: