On Mon, Oct 20, 2008 at 04:21:31PM +0100, Tomas Hlavaty wrote:
> That's nice. It could even be:
>
> (de <xml> Prg
> (prin "<" (pop 'Prg))
> (while (atom (car Prg))
> (prin " " (pop 'Prg) "=\"" (eval (pop 'Prg) 1) "\"") )
> (prin ">")
> (run Prg) # the text, or other elements
> (prinl "</text>") )
>
> (<xml> text id 123 dx (+ 3 4) dy (* 3 4)
> (prin "No font and color arguments yet") )
Yes, that's even better.
In addition, to make it more robust, we should
1. Check for an empty body (avoid an infinite loop):
(while (and Prg (atom (car Prg)))
2. Run the body in the binding environment of the caller:
(run Prg 1)
Cheers,
- Alex
--
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]