10 minutes ago, Veer wrote: > Following code returns #<undefined> : > > (define (make-color color) > (define color color) > color) > > (make-color 'red) ;; => #<undefined> > > From the guide , I get that internal definition of color is not initialized > therefore the result is #<undefined> . What does not initialized means > in this context.
You're defining a new `color', one that shadows the `color' input. If you click check-syntax and hover over the different `color's you'll see helpful arrows that indicate the bindings. (For the argument you'll see *no* errors.) `define' is basically defining a new identifier -- it's different from `set!', and sometimes confused since in many languages `=' is used for both. > My assumption was that internal color will be bound to the value of > argument. > > When was #<undefined> introduced (or it was always there). It was always there. (Or at least since the time I started using MzScheme, which was around 1854.) > I "think" I have used this type of code before , and it worked fine > then. No, it always did that... -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users