Re: Symbol matching in core.match

2011-11-30 Thread David Nolen
Looks good patch applied. On Wed, Nov 30, 2011 at 7:24 PM, Alex Miller wrote: > Ha, I wrote the identical patch locally and it seemed good to me. So > it gets my ok! > > On Nov 30, 5:00 pm, Steve Miner wrote: > > I filed the bug and attached a patch. The check for duplicate wildcards > now ig

Re: Symbol matching in core.match

2011-11-30 Thread Alex Miller
Ha, I wrote the identical patch locally and it seemed good to me. So it gets my ok! On Nov 30, 5:00 pm, Steve Miner wrote: > I filed the bug and attached a patch.  The check for duplicate wildcards now > ignores anything that's quoted.  I'm in a rush so it might be good for others > to try it

Re: Symbol matching in core.match

2011-11-30 Thread Alex Miller
That's ok by me. On Nov 30, 4:16 pm, David Nolen wrote: > > 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 ove

Re: Symbol matching in core.match

2011-11-30 Thread Steve Miner
I filed the bug and attached a patch. The check for duplicate wildcards now ignores anything that's quoted. I'm in a rush so it might be good for others to try it out. http://dev.clojure.org/jira/browse/MATCH-42 Steve Miner stevemi...@gmail.com -- You received this message because you are

Re: Symbol matching in core.match

2011-11-30 Thread David Nolen
On Wed, Nov 30, 2011 at 5:06 PM, Alex Miller 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 existin

Re: Symbol matching in core.match

2011-11-30 Thread Alex Miller
Thanks all... I'm not actually complaining that symbols are taken for bind variables. I think in most common match uses that's very natural. Your suggested change wouldn't actually help me - this was just a dummy example; in the actual case for me the symbol starts with an alpha. If I *were* goi

Re: Symbol matching in core.match

2011-11-30 Thread David Nolen
On Wed, Nov 30, 2011 at 4:29 PM, Steve Miner wrote: > > On Nov 30, 2011, at 3:04 PM, David Nolen wrote: > > (quote foo) should be interpreted as a literal match. I thought this was > addressed by a previous user submitted patch but it doesn't look like > that's true. > > > I wrote a patch that tr

Re: Symbol matching in core.match

2011-11-30 Thread Steve Miner
On Nov 30, 2011, at 3:04 PM, David Nolen wrote: > (quote foo) should be interpreted as a literal match. I thought this was > addressed by a previous user submitted patch but it doesn't look like that's > true. I wrote a patch that treated quoted keywords as literals so that ':when could be us

Re: Symbol matching in core.match

2011-11-30 Thread David Nolen
(quote foo) should be interpreted as a literal match. I thought this was addressed by a previous user submitted patch but it doesn't look like that's true. We currently use seqs as a marker of custom syntax, we dispatch either on the first or second element of the seq. For example this is how we h

Symbol matching in core.match

2011-11-30 Thread Alex Miller
I've been working with core.match some this week and finding it pretty nice. However, I have a common case (for me) that is not well handled right now via core.match: matching symbols. Say that I wrote a match like this: ;; translate (+ x (+ y z)) to (+ x y z) (let [e '(+ 1 (+ 2 3))] (match [e]