Apply forces the evaluation of one element more than necessary

Description

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:

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:

Environment

None

Assignee

Unassigned

Reporter

Nicola Mometto

Labels

None

Approval

None

Patch

Code

Priority

Major
Configure