Details
Assignee
UnassignedUnassignedReporter
Nicola MomettoNicola MomettoPatch
CodePriority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter
Nicola Mometto
Nicola MomettoPatch
Code
Priority

Created November 8, 2014 at 12:06 AM
Updated November 9, 2014 at 9:38 PM
Given a function with one fixed argument and a vararg, it should be sufficient to force evaluation of 2 elements for apply to know which arity it should select, however it currently forces 3:
user=> (defn x ([a & b])) #'user/x user=> (apply x (map println (iterate inc 0))) 0 1 2 nil
This makes lazy functions that use apply (for example mapcat) less lazy than they could be.
The proposed patch makes RT.boundedLength short-circuit immediately after the seq count is greater than the max fixed arity:
user=> (defn x ([a & b])) #'user/x user=> (apply x (map println (iterate inc 0))) 0 1 nil