diff options
author | YilunAllenChen <allenchenyilun1999@gmail.com> | 2024-12-17 19:38:47 -0600 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2024-12-19 11:58:24 +0000 |
commit | e6107961d933d9ec34503bfee10d7fdea6aea87b (patch) | |
tree | 71fc94ed45d8de9eb0525ad74915abfdd6033752 /src | |
parent | a3018d0ab4e5d6ac0fa381d7798397554f1e5a91 (diff) | |
download | gleam_stdlib-e6107961d933d9ec34503bfee10d7fdea6aea87b.tar.gz gleam_stdlib-e6107961d933d9ec34503bfee10d7fdea6aea87b.zip |
remove min
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/list.gleam | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam index 2d5b624..6c41df0 100644 --- a/src/gleam/list.gleam +++ b/src/gleam/list.gleam @@ -2337,29 +2337,3 @@ pub fn max( } }) } - -/// Takes a list and a comparator, and returns the minimum element in the list -/// -/// -/// ## Example -/// -/// ```gleam -/// range(1, 10) |> list.int(int.compare) -/// // -> Ok(1) -/// ``` -/// -/// ```gleam -/// ["a", "c", "b"] |> list.int(string.compare) -/// // -> Ok("a") -/// ``` -pub fn min( - over list: List(a), - with compare: fn(a, a) -> Order, -) -> Result(a, Nil) { - reduce(over: list, with: fn(acc, other) { - case compare(acc, other) { - order.Lt -> acc - _ -> other - } - }) -} |