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

How would you define map and filter using foldr in Haskell?

I'm doing a bit of self study on functional languages (currently using Haskell). I came across a Haskell based assignment …

haskell map functional-programming filter fold
Using Haskell's map function to calculate the sum of a list

Haskell addm::[Int]->Int addm (x:xs) = sum(x:xs) I was able to achieve to get a …

list haskell recursion fold
Difference between reduce and foldLeft/fold in functional programming (particularly Scala and Scala APIs)?

Why do Scala and frameworks like Spark and Scalding have both reduce and foldLeft? So then what's the difference between …

scala functional-programming reduce fold scalding
Haskell - foldl and foldr?

Is difference between foldl and foldr just the direction of looping? I thought there was a difference in what they …

haskell fold
Difference between fold and foldLeft or foldRight?

NOTE: I am on Scala 2.8—can that be a problem? Why can't I use the fold function the same way …

scala fold
How to fold/unfold HTML tags with Vim

Is there some plugin to fold HTML tags in Vim? Or there is another way to setup a shortcut to …

html vim folding fold
foldr and foldl further explanations and examples

I've looked at different folds and folding in general as well as a few others and they explain it fairly …

function haskell syntax combinators fold
How do you know when to use fold-left and when to use fold-right?

I'm aware that fold-left produces left-leaning trees and fold-right produces right-leaning trees, but when I reach for a fold, I …

language-agnostic functional-programming fold
iOS Paper fold (origami / accordion) effect animation, with manual control

I'm looking for tips on how to implement the popular 'paper folding / origami' effect in my iOS project. I'm aware …

iphone ios animation accordion fold
Scala : fold vs foldLeft

I am trying to understand how fold and foldLeft and the respective reduce and reduceLeft work. I used fold and …

scala reduce fold