• Naggum the COBOLer

    From B. Pym@Nobody447095@here-nor-there.org to comp.lang.lisp on Fri Jul 11 00:05:23 2025
    From Newsgroup: comp.lang.lisp

    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)
    --- Synchronet 3.21a-Linux NewsLink 1.2