[plt-scheme] why local? (just curious)

From: Thomas Chust (chust at web.de)
Date: Thu Jan 15 06:02:43 EST 2009

Sigrid Keydana wrote:
> [...]
> I remember having seen the "local" form in HDTP, but I'd thought it was
> for learning purposes only. Now I see it's used in the Continue Guide
> I'm working through and it's part of standard (PLT) scheme. I just
> wonder why it's necessary (or even "nice-to-have") - why not simply use
> let or letrec?
> [...]

Hello,

the local form is handy if you want to define a set of local functions
that are mutually recursive. You can write those with the same syntax as
on the module level inside local. In addition to define, the forms
define-syntax and define-struct are also valid inside local.

Of course you can always use a combination of letrec and let-syntax to
the same effect as local, but the syntax is more verbose. It's really a
matter of taste which you like better.


cu,
Thomas


Posted on the users mailing list.