Menu

#492 apply '+ fails for large lists (e.g. 10,000 elements)

lisp error
closed-invalid
clisp (524)
5
2008-07-23
2008-07-23
cid
No

Something bad happens when using (apply '+ ...) with large lists (in my case, a list of 10,000 elements).
e.g.:

[17]> (apply '+ (loop repeat 1000 collecting 1))
1000
[18]> (apply '+ (loop repeat 10000 collecting 1))

*** - APPLY: too many arguments given to +
The following restarts are available:
ABORT :R1 ABORT
Break 1 [19]>

The same code using #'reduce instead of #'apply works as expected even for much larger list sizes.

$ uname -a
Darwin 9.4.0 Darwin Kernel Version 9.4.0: Mon Jun 9 19:30:53 PDT 2008; root:xnu-1228.5.20~1/RELEASE_I386 i386

$ clisp --version
GNU CLISP 2.43 (2007-11-18) (built 3423136400) (memory 3423136540)
Software: GNU C 4.0.1 (Apple Inc. build 5465)
gcc -D_NONSTD_SOURCE -Igllib -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -Wmissing-declarations -Wno-sign-compare -O2 -fexpensive-optimizations -falign-functions=4 -DUNIX_BINARY_DISTRIB -DUNICODE -I. -x none -L/opt/local/lib -lintl -liconv -lc -Wl,-framework -Wl,CoreFoundation -L/opt/local/lib -lreadline -lncurses -L/opt/local/lib -liconv -L/opt/local/lib -lsigsegv -lc -R/opt/local/lib -L/usr/X11/lib -R/usr/X11/lib
SAFETY=0 HEAPCODES STANDARD_HEAPCODES GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY
libsigsegv 2.5
libiconv 1.11
libreadline 5.2
Features:
(REGEXP SYSCALLS I18N LOOP COMPILER CLOS MOP CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER SOCKETS GENERIC-STREAMS
LOGICAL-PATHNAMES SCREEN GETTEXT UNICODE BASE-CHAR=CHARACTER UNIX MACOS)
C Modules: (clisp i18n syscalls regexp)
Installation directory: /opt/local/lib/clisp-2.43/
User language: ENGLISH
Machine: I386 (I386)

Discussion

  • Sam Steingold

    Sam Steingold - 2008-07-23

    Logged In: YES
    user_id=5735
    Originator: NO

    http://www.lisp.org/HyperSpec/Body/convar_call-a_uments-limit.html

    Constant Variable CALL-ARGUMENTS-LIMIT

    Constant Value:

    An integer not smaller than 50 and at least as great as the value of lambda-parameters-limit, the exact magnitude of which is implementation-dependent.

    Description:

    The upper exclusive bound on the number of arguments that may be passed to a function.

    in clisp it is 4096.

     
  • Sam Steingold

    Sam Steingold - 2008-07-23
    • assigned_to: haible --> sds
    • status: open --> closed-invalid
     

Log in to post a comment.