Yeah, all foldl does in scheme or haskell is encapsulate this pattern. In haskell and scheme they like it for being able to compose functions. For example:
sum = foldl + 0 Perhaps not as useful in Picolisp, which is not exactly a functional language in the same sense. On Mon, Oct 8, 2018 at 5:13 PM Alexander Burger <[email protected]> wrote: > On Mon, Oct 08, 2018 at 08:50:09PM +0000, Mike wrote: > > > > > > Is there a PicoLisp function similar to the Scheme 'foldl'? > > ... > > There is no foldl. This is too general and not required in core. > > What you intent to do ? > > > > Truly, I cant imagine when somebody needs it, because > > > > (foldl cons '() '(1 2 3 4)) is (reverse) > > and > > (foldl + 0 '(1 2 3 4)) is (sum) > > Right. And for a general case, you can do > > (let Res <initValue> > (mapc '(@ (pass process-args 'Res)) > Lst1 > Lst2 > Lst3 ) > Res ) > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe > -- John Duncan
