[plt-scheme] Faking modules with define-values

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Jun 25 14:45:05 EDT 2006

On Jun 25, Jon Rafkind wrote:
> 
> > Try this:
> >
> > (define-values (make-foo foo-f)
> >   (let ()
> >     (define BLAH 2)
> >     (define-struct foo (f))
> >     (define (my-make-foo x)
> >       (make-foo (+ BLAH x)))
> >     (values my-make-foo foo-f)))
> >   
> That worked. I didnt realize you could define things in a let. I
> looked through the help-desk for a while before posting but didnt
> see anything explicitly saying I could define things in a let. Did I
> miss it?

Certain constructs allow you to have internal defines -- like the body
of a `lambda', or a `let'.  The result is equivalent to using
`letrec'.  (Roughly, since that `define-struct' is not a simple
definition.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.