Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

efficiently accumulating values

5 views
Skip to first unread message

Robert L.

unread,
Sep 22, 2017, 12:00:22 AM9/22/17
to
Giorgos Keramidas wrote:

> LOOP is clever enough to do this in a simpler way:
>
> CL-USER> (defun foo (num)
> (* num 10))
> FOO
> CL-USER> (loop for k below 10
> collect (foo k))
> (0 10 20 30 40 50 60 70 80 90)
> CL-USER>


(require srfi/42) ; list-ec

(define (foo num) (* num 10))

(list-ec (: k 10) (foo k))

===>
(0 10 20 30 40 50 60 70 80 90)

--
When the Israeli bombers and torpedo-planes were sent to attack and destroy the
ship, the Jewish commander, seeing that it was an American vessel, had
misgivings and reported to the High Command, which simply repeated the orders
to attack and sink the Liberty. www.revilo-oliver.com/rpo/Bit_of_Good_News.html
0 new messages