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

lazy-cat can cause StackOverflowError with more than 2 arguments

Description

The vararg version of concat doesn't currently short-circuit the last seq. This makes it a little different than the 2-arg version, specifically for lazy-cat and long sequences. Here's an example:

1 2 3 4 5 6 7 (defn lazy-range [i] (if (= i 0) [] (lazy-cat [(dec i)] #_[] (lazy-range (dec i))))) (last (lazy-range 10000000))

Running this code as is correctly produces 0. Uncommenting the #_[], produces a StackOverflowError.

I attached a simple fix.

Environment

None

Status

Assignee

Unassigned

Reporter

Alex Miller

Labels

None

Approval

Triaged

Patch

None

Priority

Minor