• Re: Multivalue tail recursion?

    From B. Pym@21:1/5 to Kent M. Pitman on Tue Aug 27 22:19:41 2024
    XPost: comp.lang.scheme

    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))

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)