This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Internal defines


 > 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)))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]