Re:Smjörið er brætt og hveitið smátt og smátt hrært út í það...
by pchristensen on Friday February 08, 2008 @05:30PM
(#112392)
Also curious how this would look
Re:Smjörið er brætt og hveitið smátt og smátt hrært út í það...
by eru on Monday February 18, 2008 @12:31AM
(#117950)
It could look like this:
(* (+ "a" (* "b")))
for:
"(a+b)"
[Perhaps you prefer not to re-use + and * for this.]
Sure, it's somewhat more verbose for this toy examples - but every intermediate expression (and the whole thing) is a Lisp-Object in its own right.
You would not even need macros.
Edit: There is a place for macros here to make things less verbose. Just write a macro that 'compiles': (* (+ a (* b))) into the form above.
For convenience you can offer a function that builds RegExps out of strings in the usual way.
Actually I think I have seen a library for MzScheme that does it this way.