[plt-scheme] The role of macros in solving this little problem

From: Noel Welsh (noelwelsh at gmail.com)
Date: Fri Aug 31 05:17:08 EDT 2007

On 8/31/07, Grant Rettke <grettke at acm.org> wrote:
> This is a simple almost trivial problem, and I am wondering what would
> be considered to be a "normal solution" in Scheme.
...
> In Java, Ruby or .NET one would use XML (or some equivalent like YML)
> and some sort of a transformer to generate the destination text (one
> may even use objects). In Scheme you could follow any of those
> approaches.

Yes, that is one possibility.

> One could also write macros, and then write the resume like this.
>
> (resume
>    (work-entry
>        (company "C")
>        (responsibilities
>         (entry "e1")
>         (entry "e2"))))
>
> Is that typical? Is that a typical way to approach this?

There is no need to use macros here.  You could make this a list of
symbols and string, and use match to process it.  You could make this
a combinator library that constructs structures and use match. The
second is a fancy-schmancy version of the first.

N.


Posted on the users mailing list.