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
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
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
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
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]
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
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,