Sujet : Re: (iota N) in Spice Lisp idiom
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.lisp comp.lang.schemeDate : 26. May 2024, 23:01:33
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240526135342.3@kylheku.com>
References : 1 2 3
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-05-26, B. Pym <
No_spamming@noWhere_7073.org> wrote:
On 2/27/2024, Kaz Kylheku wrote:
>
Common Lisp's loop macro has a collect{ing} clause.
(defun iota (n)
(loop for i from i to n
collect i))
>
>
Incorrect; three errors.
I only see one: it was intended to be 1 to n, not i to n. With that
correction it works to the extent that (iota 3) produces (1 2 3).
Correct:
>
(defun iota (n)
(loop for i from 0 below n
collect i))
In that post, I decided that the requirements for (iota n)
are to go from 1 to n. That's what is correct, as far as the
code goes. In my post, deciding what iota means is my privilege.
While you've gone to fuck yourself, remember to practice your
counting.