< Back to IRCAM Forum

Last argument to apply is too long: 2164

Hi

I am having this message while using flat-once :
Error while evaluation the box FLAT-ONCE:
Last-argument to apply is too long: 2164

Apparently it is limited to 2047 items…
How can we fix this ?
I hope this is not also a limitation of LispWorks :

Best
K

PS: Patch included

patch1.omp (113 KB)

Hi Karim.

flat-once uses append, which hits LW’s limit of the constant call-arguments-limit (2047)

You can probably use reduce instead, ie:

(defmethod flat-once ((list list))  
  (if (consp (car list))  
      (reduce 'append list)  
      list))

Thanx a lot Anders,

It figures… however don’t understand why there is such a limitation in LispWorks.
Or it is just related to the OM image compilation?

I reckon, you will have some reports about this… :slight_smile:

Best my friend !
K

Hi Karim. I’m not sure why LW chose that particular limitation, however the spec says the minimum allowed value for this constant is 50, so they’re at least beyond what ANSI guarantees.

Aside of that, i can’t see any reason to use #'apply instead of #'reduce in a function like #'flat-once, where there’s no traversal of the elements in the passed list. Possibly #'apply in this context will be rewritten by the compiler to some variant of #'reduce anyway…?

Or it is just related to the OM image compilation?

No, the value of call-arguments-limit is a fixed/hard-wired constant in LW.

Hi Anders.

Thank you man for the feedback.
I therefore will fall back on your suggestions.

Best
K