On Mon, 08 Oct 2018 19:15 +0000, Jon Kleiser wrote:
> Hi,
>
> Is there a PicoLisp function similar to the Scheme 'foldl'?
Hi Jon!
You've probably already gone there, but FWIW this is what I have used in the
past.
(de foldl (Op Init Xs)
(let (Acc Init)
(for X Xs (setq Acc (Op Acc X)))
Acc))
In action:
(de op (X Y) (list 'op X Y)) # The "recon" binary operator :)
(test '(op 1 2) (op 1 2))
(test # Normal usage
'(op (op (op (op (op 0 1) 2) 3) 4) 5)
(foldl op 0 (1 2 3 4 5)))
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe