:as and & interaction issue

Description

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.

Environment

clojure 1.6.0
core.match 0.3.0-alpha4
Java 8
windows 10

Activity

Show:

Greg Chapman February 12, 2016 at 12:59 AM

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.

import September 18, 2015 at 6:06 PM

Comment made by: carkh

I just tested with clojure 1.7 and get the same results

Details

Assignee

Reporter

Priority

Created September 18, 2015 at 6:01 PM
Updated February 12, 2016 at 12:59 AM