We're updating the issue view to help you get more done. 

PersistentList/creator doesn't handle ArraySeqs correctly

Description

This should return '(2 3) but returns '(1 2 3) instead:

1 2 3 user=> ((fn [& args] (apply (fn [a & b] (println a b) (apply list b)) args)) 1 2 3) 1 (2 3) (1 2 3)

Note that using vector rather than list returns the correct values:

1 2 3 user=> ((fn [& args] (apply (fn [a & b] (println a b) (apply vector b)) args)) 1 2 3) 1 (2 3) [2 3]

The bug was reported in this stackoverflow question: https://stackoverflow.com/questions/27819418/strange-behaviour-of-clojure-trampoline and the bug identified in this comment: https://stackoverflow.com/questions/27819418/strange-behaviour-of-clojure-trampoline#comments-27821793

A simpler example of this bug:

1 2 user=> (apply list (next (clojure.lang.ArraySeq/create (object-array [1 2 3])))) (1 2 3)

Patch: CLJ-1633-v3.patch

Environment

None

Status

Assignee

Unassigned

Reporter

Nicola Mometto

Labels

Approval

Ok

Patch

Code and Test

Fix versions

Priority

Critical