Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #347: The rubber band broke


comp / comp.lang.scheme / Re: Multivalue tail recursion?

SubjectAuthor
o Re: Multivalue tail recursion?B. Pym

1
Subject: Re: Multivalue tail recursion?
From: B. Pym
Newsgroups: comp.lang.lisp, comp.lang.scheme
Organization: A noiseless patient Spider
Date: Tue, 27 Aug 2024 22:19 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Nobody447095@here-nor-there.org (B. Pym)
Newsgroups: comp.lang.lisp,comp.lang.scheme
Subject: Re: Multivalue tail recursion?
Date: Tue, 27 Aug 2024 22:19:41 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <valjdo$35a95$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Wed, 28 Aug 2024 00:19:41 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="041112d065965f343e15ec8c67e04ac3";
logging-data="3320101"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+OxnTERqJuESlIir6HCpcN"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:KEWAU3bzrISpOU1RU6dd/etUQD4=
View all headers

Kent M. Pitman 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))
'(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))

1

rocksolid light 0.9.8
clearnet tor