The higher order function typically known as reduce
has a lot of synonyms in various languages.
Off the top of my head I can think of:
foldr
, foldl
(a.k.a right fold and left fold) (Haskell)inject
(Smalltalk, Ruby, Groovy)Aggregate
(LINQ)accumulate
(Wikipedia)compress
(Wikipedia)Is there a comprehensive list of all the different names this function has? If not, let's make one here. It would be useful to know.
I'm not too interested in getting the library function names from each language, I'm looking for more of a colloquial, "how is it used in a sentence" type reference.
You might note that in general, this concept is known as a catamorphism. From wikipedia, or also the cute article Functional programming with Bananas, Lenses, Envelopes and Barbed Wire.
All right, so far the total list seems to be:
catamorphism
(General term, see Kristopher's post)reduce
(Python, Clojure, Common Lisp, Ruby)reduction
(APL)foldr
, foldl
(a.k.a right fold and left fold) (Haskell, Scheme)inject
(Smalltalk, Ruby, Groovy)#inject:into
(Smalltalk)Aggregate
(LINQ)accumulate
(Wikipedia)compress
(Wikipedia)insertion
(FP)Insert
(J)Thanks for the help everyone, and if someone comes by later with a better list I'll make sure to accept that one instead!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With