core.match

Vector pattern - unreachable clause

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major 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

Hide
David Nolen added a comment -

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

Show
David Nolen added a comment - 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".

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: