Is this a bug in core.match?

2012-08-28 Thread Brian Marick
Observe: user= (defn count-sequence [ seq] (match [seq] ; [([so-far [x xs]] :seq)] (str 1: so-far x xs) [([[ sequence]] :seq)] (str 2: sequence))) user= (count-sequence [1 2 3]) 2:[1 2 3] Now uncomment the commented line: user= (defn count-sequence [ seq] (match [seq] [([so-far

Re: Is this a bug in core.match?

2012-08-28 Thread Brian Marick
This may also be relevant. The following works: (defn factorial [ args] (match [args] [([n] :seq)](factorial 1 n) [([so-far 1] :seq)] so-far [([so-far n] :seq)] (factorial (* n so-far) (dec n user= (factorial 5) 120 However, changing the order of clauses

Re: Is this a bug in core.match?

2012-08-28 Thread David Nolen
On Tue, Aug 28, 2012 at 7:01 PM, Brian Marick mar...@exampler.com wrote: Observe: user= (defn count-sequence [ seq] (match [seq] ; [([so-far [x xs]] :seq)] (str 1: so-far x xs) [([[ sequence]] :seq)] (str 2: sequence))) user= (count-sequence [1 2 3]) 2:[1 2 3] Now uncomment the

Bug in core.match?

2011-12-10 Thread Benny Tsai
Hi all, Ran into what appears to be a bug tonight. This is the simplest example I could come up with: (defn f [xs] (match xs [:a] a [:b b] b [:c] c :else problem!)) [:a] and [:b b] can be matched with no problems, but [:c] can't be matched for some

Re: Bug in core.match?

2011-12-10 Thread David Nolen
Please open a ticket on JIRA with this case - http://dev.clojure.org/jira/browse/MATCH Thanks! David On Sat, Dec 10, 2011 at 5:33 AM, Benny Tsai benny.t...@gmail.com wrote: Hi all, Ran into what appears to be a bug tonight. This is the simplest example I could come up with: (defn f [xs]

Re: Bug in core.match?

2011-12-10 Thread Benny Tsai
Done! On Saturday, December 10, 2011 9:08:22 AM UTC-7, David Nolen wrote: Please open a ticket on JIRA with this case - http://dev.clojure.org/jira/browse/MATCH Thanks! David On Sat, Dec 10, 2011 at 5:33 AM, Benny Tsai benny...@gmail.com wrote: Hi all, Ran into what appears to be a

Re: Bug in core.match?

2011-12-10 Thread David Nolen
Thanks. On Saturday, December 10, 2011, Benny Tsai benny.t...@gmail.com wrote: Done! On Saturday, December 10, 2011 9:08:22 AM UTC-7, David Nolen wrote: Please open a ticket on JIRA with this case - http://dev.clojure.org/jira/browse/MATCH Thanks! David On Sat, Dec 10, 2011 at 5:33 AM,