• Re: MAP (and variants) vs LOOP - Popular opinion observation?

    From B. Pym@21:1/5 to All on Sun Sep 8 12:06:16 2024
    XPost: comp.lang.lisp

    Then suppose you later need the loop/map to collect some of the values
    under certain conditions. You might have

    (loop for x in (get-list)
    for i from 0
    do (format t "~A - ~A~%" i x)
    if (test x)
    collect (foo x))

    Gauche Scheme

    (use srfi-13) ;; string-upcase

    (filter-map
    (lambda (x i) (print i " - " x)
    (and (string? x) (string-upcase x)))
    '(foo "an" 8 "why")
    (lrange 0))

    0 - foo
    1 - an
    2 - 8
    3 - why
    ("AN" "WHY")

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