Top "Fold" questions

In functional programming, a fold, also known variously as reduction, accumulation, or catamorphism, is a type of higher-order function that recursively applies a transformation to a data structure, "collapsing" it to a summary value

What is the 'pythonic' equivalent to the 'fold' function from functional programming?

What is the most idiomatic way to achieve something like the following, in Haskell: foldl (+) 0 [1,2,3,4,5] --> 15 Or its equivalent …

python list functional-programming reduce fold
Reduce, fold or scan (Left/Right)?

When should I use reduceLeft, reduceRight, foldLeft, foldRight, scanLeft or scanRight? I want an intuition/overview of their differences - …

scala scala-collections reduce fold
difference between foldLeft and reduceLeft in Scala

I have learned the basic difference between foldLeft and reduceLeft foldLeft: initial value has to be passed reduceLeft: takes first …

scala functional-programming fold higher-order-functions
How does foldr work?

Can anybody explain how does foldr work? Take these examples: Prelude> foldr (-) 54 [10, 11] 53 Prelude> foldr (\x y -&…

haskell combinators fold
Cross Validation in Weka

I've always thought from what I read that cross validation is performed like this: In k-fold cross-validation, the original sample …

validation weka fold
What is basic difference between fold and reduce in Kotlin? When to use which?

I am pretty confused with this both functions fold() and reduce() in Kotlin, can anyone give me a concrete example …

kotlin reduce fold
Functional programming, Scala map and fold left

What are some good tutorials on fold left? Original question, restored from deletion to provide context for other answers: I …

scala map functional-programming fold
Map, Filter, Foldr in DrRacket/Scheme

Programming language: Scheme/DrRacket We're currently going over map, filter, and foldr in my comp sci class. I understand that …

filter functional-programming scheme fold map-function
Difference between fold and reduce?

Trying to learn F# but got confused when trying to distinguish between fold and reduce. Fold seems to do the …

f# functional-programming reduce fold
Implications of foldr vs. foldl (or foldl')

Firstly, Real World Haskell, which I am reading, says to never use foldl and instead use foldl'. So I trust …

recursion functional-programming fold haskell