pjb@[EMAIL PROTECTED]
(Pascal J. Bourguignon) writes:
> Zach Beane <xach@[EMAIL PROTECTED]
> writes:
>
>> Ari Krupnik <ari@[EMAIL PROTECTED]
> writes:
>>
>>> (make-list 5 :initial-element (random 1.0))
>>
>> (mapcar #'random (make-list 5 :initial-element 1.0))
>
> Consing O(2N)...
>
> (map-into (make-list 5) (lambda () (random 1.0))) ; consing O(N).
But it still iterates twice, just doesn't create extra garbage, right?
I think map-into does the same as what I'd come up, but is cleaner; I
didn't know about map-into (I did feel weird about using rplaca):
(mapl #'(lambda (sublist)
(rplaca sublist (random 1.0))) (make-list 5))
Now that I read about map-into, why is it defined to take a sequence
as a first argument, and function as second, unlike other map*
functions?
Ari.
--
Elections only count as free and trials as fair if you can lose money
betting on the outcome.


|