From e6107961d933d9ec34503bfee10d7fdea6aea87b Mon Sep 17 00:00:00 2001 From: YilunAllenChen Date: Tue, 17 Dec 2024 19:38:47 -0600 Subject: remove min --- src/gleam/list.gleam | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'src') 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 - } - }) -} -- cgit v1.2.3