[racket] why do I get undefined , when using internal definition?
> 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.
I have no problem at all in using "let" and other.
I was just looking at the unit in guide , so I thought of defining a set of
configuration as internal define for eg :
(define configuration
(lambda (conf1 conf2 ...)
(unit
(import)
(export some-sig^)
(define conf1 conf1)
(define conf2 conf2)
....
)))
instead of
(define configuration
(lambda (s-conf1 s-conf2 ...)
(unit
(import)
(export some-sig^)
(define conf1 s-conf1)
(define conf2 s-conf2)
....
)))
Now I know that first one does not work.
Thanks
On Sun, Jul 10, 2011 at 11:36 AM, Neil Van Dyke <neil at neilvandyke.org> wrote:
> 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
> works.
>
> (define (make-color color)
> (define color2 color)
> color2)
>
> 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>
>>
>
> --
> http://www.neilvandyke.org/
>