Syndicated to Medium

This commit is contained in:
Brandon Rozek 2023-01-25 13:20:29 -05:00
parent 17e7209a41
commit bfa4e52c0b
No known key found for this signature in database
GPG key ID: 26E457DA82C9F480
15 changed files with 95 additions and 75 deletions

View file

@ -1,10 +1,14 @@
---
title: "Fold Not Only Reduces"
date: 2022-11-09T15:15:10-05:00
date: 2022-11-09 15:15:10-05:00
draft: false
tags: ["Functional Programming", "Scala", "Haskell"]
math: false
medium_enabled: true
medium_post_id: b419f7d25313
tags:
- Functional Programming
- Scala
- Haskell
title: Fold Not Only Reduces
---
One misconception when first learning about fold is that it takes a list of elements of a certain type (`List[T]`) and "reduces" it to a single item of type `T`.
@ -60,5 +64,4 @@ Haskell Example:
l5 c n if n > 5 then c ++ [n] else c
foldl l5 [] [5, 7, 1, 8, 9, 3]
-- Returns [7,8,9]
```
```