Skip to:
Unless i'm mistaken, it looks like there is some interaction problem between & patterns and :as patterns
(match [[:bar :baz]][([:bar & r] :as m)] m)-> [:bar]
I'm expecting [:bar :baz] here
This is as I expect :(match [[:bar :baz]][[:bar & r]] :a)-> :a
This is also as expected :(match [[:bar :baz]][([:bar :baz] :as m)] m)-> [:bar :baz]
so & and :as each work on its own.
clojure 1.6.0core.match 0.3.0-alpha4Java 8windows 10
Using 1.8, I get the same result. However, changing the match to a seq match produces the correct result:
So perhaps the bad interaction is specific to vector patterns.
Comment made by: carkh
I just tested with clojure 1.7 and get the same results
Unless i'm mistaken, it looks like there is some interaction problem between & patterns and :as patterns
(match [[:bar :baz]]
[([:bar & r] :as m)] m)
-> [:bar]
I'm expecting [:bar :baz] here
This is as I expect :
(match [[:bar :baz]]
[[:bar & r]] :a)
-> :a
This is also as expected :
(match [[:bar :baz]]
[([:bar :baz] :as m)] m)
-> [:bar :baz]
so & and :as each work on its own.