Group Admins

  • Profile picture of Karim
  • Profile picture of Jean

OpenMusic

Public Group active 22 hours, 28 minutes ago

User group for OpenMusic and computer-aided composition. Visit the Forum for discussions.

Last argument to apply is too long: 2164

Author 2 Subscribed Users |
Profile photo of Karim
Karim

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

October 14, 2018 at 15:28 #28096
Profile photo of anders
anders

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))
  • This reply was modified 1 month ago by Profile photo of anders anders.
October 14, 2018 at 21:13 #28099
Profile photo of Karim
Karim

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… :-)

Best my friend !
K

October 15, 2018 at 00:09 #28102
Profile photo of anders
anders

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.

October 15, 2018 at 14:39 #28106
Profile photo of Karim
Karim

Hi Anders.

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

Best
K

October 15, 2018 at 15:14 #28107

You must be logged in to reply to this topic.

Log in now