Stack overflow today led me to something … very strange. I feel like I must be
missing something crushingly obvious.
To reproduce: start racket at the command line or hit “run” on a definitions
window containing only “#lang racket”.
(define map (lambda (l f)
((null? l) '())
(else (cons (f (car l)) (map (cdr l) f)))
(Note that this version of map takes the function last.) Then, paste:
(map '(3 4 5) add1)
See this error:
map: contract violation
given: '(4 5)
argument position: 1st
Note that the error occurs on the recursive call. This means that despite being
inside of a binding of the name map, the function is using the built-in
When I try doing the same thing with a value defined in the empty program (with
the name’f’), I see the error
define-values: assignment disallowed;
cannot re-define a constant
Which leads me to the suspicion that maybe possibly this message is supposed to
be shown for the re-definition of ‘map’, as well?
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.