Sujet : Re: Multivalue tail recursion?
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.lispDate : 19. Jun 2025, 23:40:27
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250619152955.11@kylheku.com>
References : 1
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2025-06-19, B. Pym <
Nobody447095@here-nor-there.org> wrote:
(loop for x in '(3 5 7)
for y in '(2 5 8)
when (= x y)
collect (cons x y))
>
>
What if there were more than two lists?
This will handle any number of lists:
>
Scheme:
>
(filter-map
(lambda xs (and (apply = xs) xs))
What's wrong with (if (apply = xs) xs)?
'(0 3 5 7 9)
'(0 2 5.0 8 9.0)
'(2 4 5 8 9))
>
((5 5.0 5) (9 9.0 9))
This is nicer:
1> (mappend [iff = [chain list list]]
'(0 3 5 7 9)
'(0 2 5.0 8 9.0)
'(2 4 5 8 9))
((5 5.0 5) (9 9.0 9))
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca