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

From: Ryan Culpepper (ryan at cs.utah.edu)
Date: Sun Jul 10 04:23:40 EDT 2011

On 07/10/2011 01:04 AM, Veer wrote:
>> 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)
>        ....
>        )))

In that particular case, you can use 'unit-from-context' instead:

(define configuration
   (lambda (conf1 conf2 ...)
     (unit-from-context some-sig^)))

Ryan


Posted on the users mailing list.