• Naggum the COBOLer

    From B. Pym@21:1/5 to Erik Naggum on Fri Jul 11 00:05:23 2025
    Erik Naggum wrote:

    The obvious implementation of INTERSECTION is the trivial

    (defun intersection (list-1 list-2-not)
    (loop for elt in list-1
    if (member elt list-2)
    collect elt))

    Obvious only to one who would rather program in COBOL than in
    a Lispy language.

    Gauche Scheme

    "We don't need no stinkin' loops!"

    (define (intersection list-1 list-2)
    (filter (cut member <> list-2) list-1))

    (intersection (iota 22) '(-3 2 8 9 88))

    (2 8 9)

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