Re: vector-push-extend
- From: Francogrex <franco@xxxxxxxx>
- Date: Sun, 5 Apr 2009 08:43:48 -0700 (PDT)
On Apr 5, 5:29 pm, p...@xxxxxxxxxxxxxxxxx (Pascal J. Bourguignon)
wrote:
Francogrex <fra...@xxxxxxxx> writes:
(let ((x (make-array 5 :fill-pointer 0)))
(dotimes (i 10)
(vector-push-extend (random 1.0) x)) x)
Result in SBCL:
#(0.5099975 0.008324027 0.001173377 0.77798724 0.24247074 0.97725177
0.067973495 0.76105237 0.06009364 0.3982551)
In another implementation:
ERROR: The index, 5, too large.
Is this a normal result in the other implementation?
Yes. Try:
(let ((size 10))
(let ((x (make-array size :fill-pointer 0)))
(dotimes (i size)
(vector-push-extend (random 1.0) x)) x))
(or have a look at adjustable arrays).
--
__Pascal Bourguignon__http://www.informatimago.com
That works of course because size is the same; but your hint to
adjustable solved my original request which was the *extension*:
(let ((x (make-array 5 :fill-pointer 0 :adjustable t)))
(dotimes (i 10)
(vector-push-extend (random 1.0) x)) x)
works in the other implementation. It's funny though that SBCL seems
to have :adjustable t always turned on by default.
.
- Follow-Ups:
- Re: vector-push-extend
- From: Tamas K Papp
- Re: vector-push-extend
- References:
- vector-push-extend
- From: Francogrex
- Re: vector-push-extend
- From: Pascal J. Bourguignon
- vector-push-extend
- Prev by Date: Re: vector-push-extend
- Next by Date: Re: vector-push-extend
- Previous by thread: Re: vector-push-extend
- Next by thread: Re: vector-push-extend
- Index(es):
Relevant Pages
|