• Newbie style questions

    From Robert L.@21:1/5 to All on Fri Feb 11 00:38:01 2022
    (defun partition (pred list)
    (loop for item in list
    when (funcall pred item)
    collect item into in
    else
    collect item into out
    finally (return (values in out))))

    For what it's worth [if anything!], this version preserves the
    initial relative ordering of items which pass/don't-pass the
    predicate, e.g.:

    > (partition (lambda (x) (zerop (mod x 3))) (iota 30))

    (0 3 6 9 12 15 18 21 24 27)
    (1 2 4 5 7 8 10 11 13 14 16 17 19 20 22 23 25 26 28 29)

    Gauche Scheme:

    (partition (lambda (x) (zero? (modulo x 3))) (iota 30))
    ===>
    (0 3 6 9 12 15 18 21 24 27)
    (1 2 4 5 7 8 10 11 13 14 16 17 19 20 22 23 25 26 28 29)

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