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

.Re: LOOP blows!

9 views
Skip to first unread message

Robert L.

unread,
Jul 21, 2017, 3:19:59 PM7/21/17
to
Kaz Kylheku wrote:

> (loop for i from 5 downto 2
> appending (loop for j below i collect j))

Output:

(0 1 2 3 4 0 1 2 3 0 1 2 0 1)


(use srfi-42) ; list-ec

(list-ec (: i 5 1 -1) (: j i) j)

===>
(0 1 2 3 4 0 1 2 3 0 1 2 0 1)

--
In Jerusalem, the United Nations (a truly United Nations) will build a Shrine
of the Prophets to serve the federated union of all continents; this will be
the seat of the Supreme Court of Mankind to settle all controversies among the
federated continents, as prophesied by Isaiah.
--- David Ben Gurion (Look, 16 January 1962)

Robert L.

unread,
Jul 22, 2017, 6:51:26 AM7/22/17
to
On 7/21/2017, Robert L. wrote:

> Kaz Kylheku wrote:
>
> > (loop for i from 5 downto 2
> > appending (loop for j below i collect j))
>
> Output:
>
> (0 1 2 3 4 0 1 2 3 0 1 2 0 1)
>
>
> (use srfi-42) ; list-ec
>
> (list-ec (: i 5 1 -1) (: j i) j)
>
> ===>
> (0 1 2 3 4 0 1 2 3 0 1 2 0 1)


(use list-comprehensions)

(for* ((i 5 (sub1 i) (< i 2)) (j 0 (add1 j) (= j i))) j)
===>
(0 1 2 3 4 0 1 2 3 0 1 2 0 1)

--
When I was a Revolutionary Marxist, we were all in favour of as much
immigration as possible. It wasn't because we liked immigrants, but because we
didn't like Britain.
dailymail.co.uk/news/article-2301743/How-invasion-immigrants-corner-England-mockery-PMs-promise-close-door.html
0 new messages