diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/float.gleam | 8 | ||||
-rw-r--r-- | src/gleam/int.gleam | 8 | ||||
-rw-r--r-- | src/gleam/list.gleam | 11 | ||||
-rw-r--r-- | src/gleam/order.gleam | 7 |
4 files changed, 15 insertions, 19 deletions
diff --git a/src/gleam/float.gleam b/src/gleam/float.gleam index 653a4d6..1eda66b 100644 --- a/src/gleam/float.gleam +++ b/src/gleam/float.gleam @@ -15,10 +15,10 @@ pub fn compare(a: Float, b: Float) -> Order { case a == b { True -> order.Eq False -> - case a <. b { - True -> order.Lt - False -> order.Gt - } + case a <. b { + True -> order.Lt + False -> order.Gt + } } } diff --git a/src/gleam/int.gleam b/src/gleam/int.gleam index 7fd7fa6..a638602 100644 --- a/src/gleam/int.gleam +++ b/src/gleam/int.gleam @@ -11,10 +11,10 @@ pub fn compare(a: Int, b: Int) -> Order { case a == b { True -> order.Eq False -> - case a < b { - True -> order.Lt - False -> order.Gt - } + case a < b { + True -> order.Lt + False -> order.Gt + } } } diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam index eaa0b23..6ea102e 100644 --- a/src/gleam/list.gleam +++ b/src/gleam/list.gleam @@ -235,8 +235,7 @@ pub fn strict_zip(l1: List(a), l2: List(b)) -> Result(List(tuple(a, b)), LengthM pub fn intersperse(list: List(a), with elem: a) -> List(a) { case list { - [] -> [] - [x | []] -> [x] + [] | [_] -> list [x | rest] -> [x | [elem | intersperse(rest, elem)]] } } @@ -248,10 +247,10 @@ pub fn at(in list: List(a), get index: Int) -> Option(a) { case list { [] -> result.none() [x | rest] -> - case index == 0 { - True -> Ok(x) - False -> at(rest, index - 1) - } + case index == 0 { + True -> Ok(x) + False -> at(rest, index - 1) + } } } } diff --git a/src/gleam/order.gleam b/src/gleam/order.gleam index bc0aaeb..1c5a417 100644 --- a/src/gleam/order.gleam +++ b/src/gleam/order.gleam @@ -22,11 +22,8 @@ pub fn to_int(order: Order) -> Int { pub fn compare(a: Order, b: Order) -> Order { case a, b { - Lt, Lt -> Eq - Lt, _ -> Lt - Eq, Eq -> Eq - Gt, Gt -> Eq - Eq, Gt -> Lt + x, y if x == y -> Eq + Lt, _ | Eq, Gt -> Lt _, _ -> Gt } } |