diff options
author | Louis Pilfold <louis@lpil.uk> | 2019-04-18 15:23:06 +0000 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-04-18 15:23:06 +0000 |
commit | 218feb66554f8d88fa334a54ec30362d0688097c (patch) | |
tree | 5b0b9d1ee6b87ad02c91799928abed1d8727f56c /src | |
parent | 108d01c3efda55d63193f33e29fb878b07313dfc (diff) | |
download | gleam_stdlib-218feb66554f8d88fa334a54ec30362d0688097c.tar.gz gleam_stdlib-218feb66554f8d88fa334a54ec30362d0688097c.zip |
Formatting
Being picky :)
Diffstat (limited to 'src')
-rw-r--r-- | src/list.gleam | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/list.gleam b/src/list.gleam index 2571318..6bcebb2 100644 --- a/src/list.gleam +++ b/src/list.gleam @@ -164,8 +164,8 @@ pub fn all(list, f) { | [] -> True | [x | rest] -> case f(x) { - | True -> all(rest, f) - | _ -> False + | True -> all(rest, f) + | _ -> False } } } @@ -175,8 +175,8 @@ pub fn any(list, f) { | [] -> False | [ x | rest] -> case f(x) { - | False -> any(rest, f) - | _ -> True + | False -> any(rest, f) + | _ -> True } } } @@ -205,8 +205,8 @@ pub fn at(list, i) { | [] -> Error(NotFound) | [x | rest] -> case i == 0 { - | True -> Ok(x) - | False -> at(rest, i - 1) + | True -> Ok(x) + | False -> at(rest, i - 1) } } } @@ -214,8 +214,8 @@ pub fn at(list, i) { pub fn unique(list) { case list { - | [] -> [] - | [x | rest] -> [x | unique(filter(rest, fn(y) { y != x }))] + | [] -> [] + | [x | rest] -> [x | unique(filter(rest, fn(y) { y != x }))] } } @@ -225,8 +225,8 @@ fn merge_sort(a, b) { | {_, []} -> a | {[ax | ar], [bx | br]} -> case ax < bx { - | True -> [ax | merge_sort(ar, b)] - | False -> [bx | merge_sort(a, br)] + | True -> [ax | merge_sort(ar, b)] + | False -> [bx | merge_sort(a, br)] } } } @@ -234,11 +234,11 @@ fn merge_sort(a, b) { pub fn sort(list) { let list_length = length(list) case list_length < 2 { - | True -> list - | False -> - let split_length = list_length / 2 - let a_list = take(list, split_length) - let b_list = drop(list, split_length) - merge_sort(sort(a_list), sort(b_list)) + | True -> list + | False -> + let split_length = list_length / 2 + let a_list = take(list, split_length) + let b_list = drop(list, split_length) + merge_sort(sort(a_list), sort(b_list)) } } |