Details
-
Type:
Defect
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Clojure 1.3, core.match 0.2.0-alpha8
Description
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 reason:
user=> (f [:a])
"a"
user=> (f [:b 1])
1
user=> (f [:c])
"problem!"
Activity
David Nolen
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Summary | Vector pattern with binding interfering with subsequent non-binding pattern | Vector pattern - unreachable clause |
David Nolen
made changes -
| Resolution | Completed [ 1 ] | |
| Status | Open [ 1 ] | Resolved [ 5 ] |
This will have to wait for http://dev.clojure.org/jira/browse/MATCH-31. There are some deeper issues with vector pattern matching that need to get ironed out first.
In the meantime just put your [:c] test above [:b b]. The key idea is to keep vector patterns of the same size "together".