[plt-scheme] Help with ...

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Sat May 16 18:19:52 EDT 2009

On Sat, May 16, 2009 at 4:22 PM, Eli Barzilay <eli at barzilay.org> wrote:

> On May 16, Todd O'Bryan wrote:
>
> > And I'm supposed to rewrite letfuns so that it can handle mutually
> > recursive functions. More concretely, I write
> >
> > (rewrite (letfuns ([(f x) E] ...) B)
> >          => (my-code-here))
> >
> > so that something like this
> >
> > (letfuns
> >   ([(even? n) (if (= n 0) #t (odd? (- n 1)))]
> >    [(odd? n) (if (= n 0 #f (even? (- n 1))))])
> >          (even? 123))
> >
> > would produce the expected answer.
> >
>
> Well, since `f' (for example) is the list of function names, you could
> write
>
>  (rewrite (letfuns ([(f x) E] ...) B)
>            => (list 'f ...))
>
> This will make a `letfuns' expression evaluate to a list of the
> function names as symbols.


OK. I think I understand now. I need to combine (list 'f ...) (list x ...)
and (list E ...) in the correct way, using map.

I'm having trouble keeping clear which level--syntactic or semantic--and
which language--the underlying implementation language or the language I'm
interpreting--I'm working in. Which is, I guess, the point. :-)

Todd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090516/cb0d2b41/attachment.html>

Posted on the users mailing list.