[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: loop translations (was: Re: language translator help)
From: |
Eric E Moore |
Subject: |
Re: loop translations (was: Re: language translator help) |
Date: |
Mon, 29 Apr 2002 21:50:10 +0100 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.2 |
Clinton Ebadi <address@hidden> writes:
[...]
> Which brings me to my problem...I tried to redefine the for macro as a
> syncase macro (so I could add (break) and (continue) inside of the macro,
> which wasn't working with define-macro)...and I have a problem:
[...]
> So, what are the rules for using ... exactly ? If I remove the parens around
> (var start end), it almost works, instead I get:
Basically there needs to be a plain identifier before them, that needs
to appear before the corresponding ... in the replacement. Rather
than thinking of the pattern think of the pattern <something> ...
you want something more like:
(define-syntax for
(syntax-rules ()
((for (var start end) body ...)
(catch 'break
(lambda ()
(let loop ((var start))
(catch 'continue
(lambda ()
(cond ((<= var end)
body ...
(throw 'continue))))
(lambda ignored
(loop (+ var 1))))))
(lambda ignored
(if #f #f #f))))))
> so it works for the first time, but then fails...the lack of documentation
> about "new" macros doesn't help me either :-)
The r5rs description is... less than transparant, I'll grant :)
--
Eric E. Moore
pgptgpECnszuy.pgp
Description: PGP signature
- Re: language translator help, (continued)
- Re: loop translations (was: Re: language translator help), Marius Vollmer, 2002/04/28
- Re: loop translations (was: Re: language translator help), John W. Eaton, 2002/04/28
- Re: loop translations (was: Re: language translator help), Marius Vollmer, 2002/04/28
- Re: loop translations (was: Re: language translator help), Marius Vollmer, 2002/04/28
- Re: loop translations (was: Re: language translator help), Clinton Ebadi, 2002/04/29
- Re: loop translations (was: Re: language translator help),
Eric E Moore <=
- Re: loop translations (was: Re: language translator help), Eric E Moore, 2002/04/30
- Re: loop translations (was: Re: language translator help), Neil Jerram, 2002/04/28
translators and scoping rules (was: Re: language translator help), John W. Eaton, 2002/04/27
Re: translators and scoping rules (was: Re: language translator help), Per Bothner, 2002/04/28
Re: translators and scoping rules (was: Re: language translator help), John W. Eaton, 2002/04/28
Re: translators and scoping rules (was: Re: language translator help), Per Bothner, 2002/04/29