[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how expressive are they?




Noel,

Very nice example.  It took me a moment to realize that you weren't
eliding code, the ellipsis was *part* of the code (I'm more used to
defmacro than syntax-rules).  That in turn made me realize that
macro-definition forms (whether using destructuring-bind or more complex
pattern matching) are themselves a good example of something that's hard
to do without macros...

On Mon, 25 Nov 2002, Noel Welsh wrote:

> (xml-macro book
>      (xml-rules
>       ((_ title: bt
>           (poem title: t poet: a tag: m
>                 (stanza (line l1) (line l) ...) ...)
> ...)
>        (xml-template
>           (h4:html
>            (h4:head (h4:title bt))
>            (h4:body
>              (h4:h1 bt)
>              (h4:p) "Table of Contents:"
>              (h4:ul (h4:li (h4:a h4:href:
> (string-append "#" m) t)) ...)
>              (h4:div (h4:p) (h4:a h4:name: m)
> (h4:strong t) (h4:br) (h4:em a)
>                      (list (h4:p) l1 (list (h4:br) l)
> ...) ...) ...))))))
>
>
> Rewrite that as succinctly and clearly in
> Perl/Smalltalk/your-favourite-PL
>
> Noel
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>