Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Kaz Kylheku <643-408-1753@kylheku.com> Newsgroups: comp.lang.lisp Subject: Re: Multivalue tail recursion? Date: Thu, 19 Jun 2025 22:40:27 -0000 (UTC) Organization: A noiseless patient Spider Lines: 37 Message-ID: <20250619152955.11@kylheku.com> References: <1031uct$4mnm$1@dont-email.me> Injection-Date: Fri, 20 Jun 2025 00:40:28 +0200 (CEST) Injection-Info: dont-email.me; posting-host="c495b87f5515ceeb64b5acf06987ff4a"; logging-data="194670"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ZUdpcUNpcIaZ5SbKnJt5AxvwhrH9Ddkc=" User-Agent: slrn/pre1.0.4-9 (Linux) Cancel-Lock: sha1:eoiYatw5oSB6lLqoTMpglzn8x/E= On 2025-06-19, B. Pym 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/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca