HPM Education - Haskell

Searchβ¦

Introduction

Types in Haskell

Defining Functions / Working with Functions

List Comprehensions

Higher-order Functions

Recursion

Cutom Types

Interactive Programming

Functors, Applicatives and Monads

Folds

A **fold **or a **folding function** is a higher-order function that processes a data structure (e.g. a list) in some order and builds a return value along the way. Therefore, a fold needs three things to work - a function that combines the elements, a starting value, and the data structure where the elements are stored. There are two basic folding functions defined in the Haskell Prelude,

`foldr`

and `foldl`

. The difference between them is the order in which they apply the combining function to the elements.β

Last modified 1yr ago

Copy link