Skip to content

Instantly share code, notes, and snippets.

@beoliver
Created May 10, 2015 19:03
Show Gist options
  • Save beoliver/8622ee410df41b4ab3a9 to your computer and use it in GitHub Desktop.
Save beoliver/8622ee410df41b4ab3a9 to your computer and use it in GitHub Desktop.
let vs define
> (define (foo)
(let ((xs '(1 2 3)))
(define (f)
(set! xs 0))
(f)
xs))
> (foo)
0
> (define (bar)
(define (f)
(set! xs 0))
(define xs '(1 2 3))
(f)
xs)
> (bar)
0
> (define (baz)
(define (f)
(set! xs 0))
(let ((xs '(1 2 3)))
(f)
xs))
> (baz)
set!: assignment disallowed;
cannot set undefined
variable: xs
context...:
stdin::13854: baz
/Applications/Racket v6.0/collects/racket/private/misc.rkt:87:7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment