"fold": a replacement for "reduce"
Timon Gehr
timon.gehr at gmx.ch
Thu Mar 27 15:29:00 PDT 2014
On 03/27/2014 03:45 PM, monarch_dodra wrote:
>
> Right, but what about "fold" vs "fold_left"? Is there a difference?
'fold' is not descriptive enough. Ranges/lists have a very particular
structure allowing 'foldl' to make sense. In general recursive data
types (eg. think binary tree) allow only one fold (the recursive one).
The instantiation for lists is 'foldr'.
I'd rather have this named 'foldl'. 'fold' is a more abstract name
'foldr' rather than 'foldl'.
More information about the Digitalmars-d
mailing list