picrin/t/closure.scm

24 lines
268 B
Scheme
Raw Permalink Normal View History

(import (scheme base)
(scheme write))
2013-10-28 21:16:56 -04:00
(begin
(define foo (lambda (a)
(lambda ()
a)))
(define bar (foo 1))
; must be 1
(write (bar))
(newline)
(define baz (foo 2))
; must be 2
(write (baz))
(newline)
; must be 1
(write (bar))
(newline))