On Fri, Jul 17, 2015 at 06:46:24PM -0500, Erik Gustafson wrote:
> [de mapeach "E" # expression
> ...
> Pretty cute in PicoLisp too :)
> It works great for single variable expressions.
>
> : (mapeach N (1 2 3) (* N N))
> -> (1 4 9)
An even more "cute" solution would be if we could avoid the parameter
argument completely.
The natural way for this in PicoLisp is the implied parameter '@'.
We might define
(de map@ "Args"
(mapcar
'(("E") (and "E" (run (cdr "Args")))) # 'and' sets '@'
(eval (car "Args")) ) )
With that, you can call
: (map@ (1 2 3) (* @ @))
-> (1 4 9)
♪♫ Alex
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe