mapcat is too eager

Description

The following expression prints 1234 and returns 1:

The reason is that (apply concat args) is not maximally lazy in its arguments, and indeed will realize the first four before returning the first item. This in turn is essentially unavoidable for a variadic concat.

This could either be fixed just in mapcat, or by adding a new function (to clojure.core?) that is a non-variadic equivalent to concat, and reimplementing mapcat with it:

Environment

None

Assignee

Unassigned

Reporter

gfredericks

Labels

Approval

Triaged

Patch

Code and Test

Affects versions

Priority

Minor
Configure