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

From: Jos Koot (jos.koot at telefonica.net)
Date: Sun Jul 10 12:25:46 EDT 2011

When I have a lot of functions to define that may be recursive and even
mutually recursive, I frequently use define in stead of explicit letrec.
With a lot of variables to be bound, the boundlist of letrec may become
incomprehensibly long.

Jos

-----Original Message-----
From: users-bounces at racket-lang.org [mailto:users-bounces at racket-lang.org]
On Behalf Of Grant Rettke
Sent: domingo, 10 de julio de 2011 17:37
To: Eli Barzilay
Cc: users
Subject: Re: [racket] why do I get undefined ,when using internal
definition?

On Sun, Jul 10, 2011 at 9:53 AM, Grant Rettke <grettke at acm.org> wrote:
> On Sun, Jul 10, 2011 at 1:49 AM, Eli Barzilay <eli at barzilay.org> wrote:
>> `define' is defining a potentially recursive value, so that
>>
>>  (define (loop) (loop))
>>
>> works as you expect.  In simple terms, you can think about an internal
>> define as something that expands to a `letrec'.  So what you wrote is
>> basically the same as
>>
>>  (define (make-color color)
>>    (letrec ([color color])
>>      ...))
>
> In what kind of situations would you use internal define over letrec?

Sorry I mean using define rather than a letrec explicitly.

_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users




Posted on the users mailing list.