query
On this page

fold

lib.fold

Docs pulled from | This Revision | 44 minutes ago


fold is an alias of foldr for historic reasons.

This function will be removed in 26.05.

(lib.lists.fold)

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;