Lisp Knowledgebase

Title: Number of arguments limit in a function call

ID: 10014


Product: All
Version: All
OS: All

Description:
ANSI Common Lisp states that the value of CALL-ARGUMENTS-LIMIT, a positive integer one greater that the maximum number of arguments in a function call, is implementation dependent but must not be smaller than 50. In LispWorks it is set at 2047.

This value cannot be altered.

This limit exists because it isn't reasonable to have a very high value of CALL-ARGUMENTS-LIMIT because it impacts on other aspects of the system.

One suggestion for working around this limit might be to use the REDUCE function - see
  http://www.lispworks.com/reference/HyperSpec/Body/f_reduce.htm

If you have a genuine case of many arguments and REDUCE is not appropriate,
build a list containing all these objects and send that as a single argument to
your function.

CL-USER 52 > call-arguments-limit
2047


CL-USER 53 > (progn (setf foo (loop for i from 0 to call-arguments-limit collect i)) nil)
NIL


CL-USER 54 > (apply #'max foo)

Error: Last argument to apply is too long.
 1 (abort) Return to level 0.
 2 Return to top loop level 0.


Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.


CL-USER 55 : 1 >


Note: LispWorks 4.4 and earlier versions have lower values for CALL-ARGUMENTS-LIMIT.

See Also:
Workaround:
(reduce #'max foo)
=>

2047

or build a list containing all the objects and pass that as a single argument to your function.
Patch:

Hardware:N/A
Summary:I can't pass more than 300 arguments to apply
Bug#:
Patch Enhancement#:
Reported:

Company     Contact     Privacy Policy     Terms of Use