Skip to content

Commit

Permalink
Fixed error and split first applicative into two steps
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrik Kirk committed Oct 1, 2024
1 parent e830421 commit 2d7184f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions slides/06/monads.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ Note:
```fsharp
val collect: (mapping: 'T -> 'U list) -> (list: 'T list)
-> 'U list
[1..4] |> List.map (fun x -> [1..x])
[1..4] |> List.collect (fun x -> [1..x])
// [1; 1; 2; 1; 2; 3; 1; 2; 3; 4]
```
<!-- .element: class="fragment" -->
Expand All @@ -481,11 +481,12 @@ module List =
l |> List.map f)
let odds = [1;3;5;7;9]
let evens = [2;4;6;8;0]
let partialApplied numbers =
(List.apply
(List.apply [fun odd even -> (odd, even)] odds)
numbers)
let all =
(List.apply
(List.apply [fun odd even -> (odd, even)]
odds)
evens)
(partialApplied evens)
type allFaces = []
type allSuits = []
Expand Down

0 comments on commit 2d7184f

Please sign in to comment.