query
On this page

fold

lib.lists.fold

Docs pulled from | This Revision | 14 minutes ago


fold is an alias of foldr for historic reasons


Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

foldr = op: nul: list:
    let
      len = length list;
      fold' = n:
        if n == len
        then nul
        else op (elemAt list n) (fold' (n + 1));
    in fold' 0;