This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Internal defines
- To: Marius Vollmer <mvo at zagadka dot ping dot de>
- Subject: Re: Internal defines
- From: Daniel Hagerty <hag at linnaean dot org>
- Date: Tue, 5 Oct 1999 15:53:05 -0400
- Cc: Lauri Alanko <la at iki dot fi>, guile at sourceware dot cygnus dot com
- References: <19991005022452.A1102@iki.fi><87emf9tyg9.fsf@zagadka.ping.de>
- Reply-To: Daniel Hagerty <hag at linnaean dot org>
> From: Marius Vollmer <mvo@zagadka.ping.de>
> Date: 05 Oct 1999 21:11:18 +0200
>
> Lauri Alanko <la@iki.fi> writes:
>
> > I just wouldn't much like an extra level of indentation.. is there
> > any way to implement some kind of a define* macro that would
> > transform the body of a lambda into a let* expression? Or what would
> > be the best way to get what I want?
>
> My preferred way would be to rewrite internal defines into a letrec*
> where letrec* is the same as letrec but with the sequential
> initialisation semantics of let*.
>
> But this woul require changes to Guile itself and so is probably of no
> help to you right now.
>
> What do others think? Would such a change be welcome?
Am I missing something? This (untested) basic transform strikes
me as what the user is asking for; this should be easy enough to do
with a hygienic macro system or syntax transformer (there are a bunch
of degenerate cases the transformer would need to handle, but you get
the idea).
(define* (bar)
((a (lambda () b))
(b (lambda () 'some-crazy-frob)))
(a))
=>
(define (bar)
(let* ((a '*false*)
(b '*false*))
(begin
(set! a (lambda () b))
(set! b (lambda () 'some-crazy-frob)))
(a)))