<< Back to previous view

[MATCH-43] Vector pattern - unreachable clause Created: 10/Dec/11  Updated: 28/Jul/13  Resolved: 27/Dec/11

Status: Closed
Project: core.match
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Benny Tsai Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None

Clojure 1.3, core.match 0.2.0-alpha8


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])
user=> (f [:b 1])
user=> (f [:c])

Comment by David Nolen [ 12/Dec/11 9:24 PM ]

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".

Comment by David Nolen [ 27/Dec/11 8:23 PM ]

fixed, https://github.com/clojure/core.match/commit/b2ee29d701a9306c1c494d91c371c01a512aee0c

Generated at Tue Jan 23 18:14:05 CST 2018 using JIRA 4.4#649-r158309.