On Wed, Nov 30, 2011 at 5:06 PM, Alex Miller <[email protected]> wrote:
> ;; plus is a symbol to match, _x, _y are variables
> (let [e '(plus 2 3)]
> (match [e]
> [([plus _x _y] :seq)] (+ _x _y)))
>
> To me, that gives them a "placeholder" feel and plays well with the
> use of _. This would break all existing code of course, so I don't
> suggest this too seriously. :)
>
> Alex
So you want to use match for matching forms without having to quote
everything?
(let [e '(plus 2 3)]
(match e
['plus x y] (+ x y)))
To me the above would be ideal. Then it would be trivial for you to write
macro over match say match-syntax which converts from this form:
(let [e '(plus 2 3)]
(match-syntax e [plus]
(plus x y) (+ x y)))
A quick sketch - kinda syntax-rules-y. Probably something better lurking.
David
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en