[racket] why do I get undefined , when using internal definition?

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Sun Jul 10 02:06:46 EDT 2011

Unless I'm being stupid at this hour, I think you've found a bug: either 
it should work as you originally expected, or it should raise an error 
to complain about an internal "define" referencing itself like that and 
ignoring the pre-existing binding from the argument.  Note that, if you 
rename the internal binding to "color2" to reflect what you expected, it 

(define (make-color color)
 (define color2 color)

Just between you and me, I never use internal "define".  I came from 
RnRS, where "define" was only used at top level, and top level is 
fraught with witchcraft.  "let", "let*", "let-values", and "let*-values" 
are more straightforward, overall, IMHO.

Veer wrote at 07/10/2011 01:41 AM:
> (define (make-color color)
>  (define color color)
>  color)
> (make-color 'red)  ;; => #<undefined>


Posted on the users mailing list.