core.match

Exception thrown when matching using :seq when there is a seq call in the tail of the occurrences

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Environment:
    with Clojure 1.3

Description

The following match throws:

(let [q '(a) y '(b) z '(c)]
  (match [q (seq y) z]
    [([_] :seq) _ _] 'a
    [_ _ _] 'b))

Looking at the macro expansion there's something clearly wrong simply with the fact that the seq expression occurs in multiple places instead of just at the beginning of the macro expansion.

Activity

David Nolen made changes -
Field Original Value New Value
Description <iframe style="width: 648px; height: 400px; border: 0px;" src="http://refheap.com/paste/3294/framed" >

I also tested with three occurrences. When there is a seq call in the second occurrence onward a RuntimeException is thrown.
The following match throws:

{code}
(let [q '(a) y '(b) z '(c)]
(match [q (seq y) z]
  [([_] :seq) _ _] 'a
  [_ _ _] 'b))
{code}

I suspect we have a simple issue around assuming if one variable will be an expression, they all will be.
David Nolen made changes -
Description The following match throws:

{code}
(let [q '(a) y '(b) z '(c)]
(match [q (seq y) z]
  [([_] :seq) _ _] 'a
  [_ _ _] 'b))
{code}

I suspect we have a simple issue around assuming if one variable will be an expression, they all will be.
The following match throws:

{code}
(let [q '(a) y '(b) z '(c)]
(match [q (seq y) z]
  [([_] :seq) _ _] 'a
  [_ _ _] 'b))
{code}

Looking at the macro expansion there's something clearly wrong simply with the fact that the seq expression occurs in multiple places instead of just at the beginning of the macro expansion.
David Nolen made changes -
Status Open [ 1 ] In Progress [ 3 ]
David Nolen made changes -
Resolution Completed [ 1 ]
Status In Progress [ 3 ] Resolved [ 5 ]
David Nolen made changes -
Description The following match throws:

{code}
(let [q '(a) y '(b) z '(c)]
(match [q (seq y) z]
  [([_] :seq) _ _] 'a
  [_ _ _] 'b))
{code}

Looking at the macro expansion there's something clearly wrong simply with the fact that the seq expression occurs in multiple places instead of just at the beginning of the macro expansion.
The following match throws:

{code}
(let [q '(a) y '(b) z '(c)]
  (match [q (seq y) z]
    [([_] :seq) _ _] 'a
    [_ _ _] 'b))
{code}

Looking at the macro expansion there's something clearly wrong simply with the fact that the seq expression occurs in multiple places instead of just at the beginning of the macro expansion.
David Nolen made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: