Loopy idiocy

13 views
Skip to first unread message

Robert L.

unread,
Mar 26, 2022, 5:59:45 PMMar 26
to
> (loop for x in list
> do (my-fcn x)
> return list)
>
> with the equivalent map forms...
>
> The latter example doesn't do what you think it does. It will call
> MY-FCN on the first element of LIST, and then return LIST. To be
> equivalent to mapc, it needs to be:
>
> (loop for x in list
> do (my-fcn x)
> FINALLY (return list))
>
> with the return in parentheses!

Gauche Scheme:

(define xs '(b c d))

(for-each print xs)

===>
b
c
d

Jeff Barnett

unread,
Mar 26, 2022, 7:48:11 PMMar 26
to
Yours is incorrect. Read the spec above.
--
Jeff Barnett
Reply all
Reply to author
Forward
0 new messages