Hi list,
I came across a cute little Common Lisp macro, mapeach
<http://malisper.me/2015/06/14/mapeach/>. Naturally, I wanted it to play
with it in PicoLisp. The most straightforward translation (for me) of the
code in the post was:
[de mapeach "E" # expression
(let [(@Var @List . @Body) "E"]
(macro
(mapcar
'((@Var) . @Body)
@List ]
Pretty cute in PicoLisp too :)
It works great for single variable expressions.
: (mapeach N (1 2 3) (* N N))
-> (1 4 9)
Multiple vars will make it angry (return NIL).
But! I get the feeling that using (macro) is not quite idiomatic PicoLisp ;)
What are some other ways this could be written? I'm thinking it might be in
the spirit of do*, as defined in the FAQ, but I don't fully understand that
code.
Thanks!