Re: What is expensive about consing
- From: awhite <spudboy@xxxxxxxxxxxx>
- Date: Wed, 10 Sep 2008 17:11:04 +0800
On Wed, 10 Sep 2008 08:12:12 +0200, Pascal J. Bourguignon wrote:
[non-guaranteed CL:APPLY for arbitrarily sized lists]
Because of call-arguments-list. The portable form is:
(if (< (length number-list) call-arguments-limit)
(apply (function +) number-list)
(reduce (function +) number-list))
Ah, thanks. That sucks for execution speed, though! O(N) for the CL:LENGTH
operation on a list, when (depending on domain, of course), you're very
unlikely to exceed call-arguments-limit (4096 on my local CLISP) in a
single list.
But even if you take Rob's good suggestion of a :max-args keyword, is
there an efficient way of splitting variable-length lists into chunks?
You still need to traverse each cons (via ELT or similar) to chop them up.
Either way of doing it (CL:REDUCE vs split-into-c-a-l-sizes and then
CL:APPLY on each list) still seems like O(N2) performance either way.
Adam
.
- Follow-Ups:
- Re: What is expensive about consing
- From: Raymond Toy
- Re: What is expensive about consing
- From: John Thingstad
- Re: What is expensive about consing
- References:
- What is expensive about consing
- From: Andy Chambers
- Re: What is expensive about consing
- From: John Thingstad
- Re: What is expensive about consing
- From: namekuseijin
- Re: What is expensive about consing
- From: Rob Warnock
- Re: What is expensive about consing
- From: awhite
- Re: What is expensive about consing
- From: Pascal J. Bourguignon
- What is expensive about consing
- Prev by Date: Re: What is expensive about consing
- Next by Date: Re: What is expensive about consing
- Previous by thread: Re: What is expensive about consing
- Next by thread: Re: What is expensive about consing
- Index(es):
Relevant Pages
|