diff options
author | Michael Jones <m.pricejones@gmail.com> | 2022-01-03 15:20:35 +0000 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2022-01-03 15:25:14 +0000 |
commit | 2c7c5d2a511bd5cb6ed65214790c5a91488dd7e5 (patch) | |
tree | dfb1b105e553c5cf9683a206093dc547db81731d | |
parent | 776136b146baa7ea7535bbb168ff331850569c3a (diff) | |
download | gleam_stdlib-2c7c5d2a511bd5cb6ed65214790c5a91488dd7e5.tar.gz gleam_stdlib-2c7c5d2a511bd5cb6ed65214790c5a91488dd7e5.zip |
Adjust list.fold examples
Some of the args are in the wrong places.
-rw-r--r-- | src/gleam/list.gleam | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam index 54d9c81..9acc6ce 100644 --- a/src/gleam/list.gleam +++ b/src/gleam/list.gleam @@ -526,7 +526,7 @@ pub fn flat_map(over list: List(a), with fun: fn(a) -> List(b)) -> List(b) { /// Reduces a list of elements into a single value by calling a given function /// on each element, going from left to right. /// -/// `fold(0, [1, 2, 3], add)` is the equivalent of `add(3, add(2, add(1, 0)))`. +/// `fold([1, 2, 3], 0, add)` is the equivalent of `add(add(add(0, 1), 2), 3)`. /// /// This function runs in linear time. /// @@ -544,8 +544,8 @@ pub fn fold( /// Reduces a list of elements into a single value by calling a given function /// on each element, going from right to left. /// -/// `fold_right(0, [1, 2, 3], add)` is the equivalent of -/// `add(1, add(2, add(3, 0)))`. +/// `fold_right([1, 2, 3], 0, add)` is the equivalent of +/// `add(add(add(0, 3), 2), 1)`. /// /// This function runs in linear time. /// |