Thanks for all the answers. The reason I asked was, I’ve been playing a bit 
with Racket doing some “heavy” floating-point math, and I got quite used to the 
‘foldl’ function. Then I couldn’t remember having seen that function or 
anything quite similar i PicoLisp.

/Jon

> On 9. Oct, 2018, at 04:51, r...@tamos.net wrote:
> 
> 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)))
> 

Reply via email to