Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "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: 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= Bytes: 1231 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))