diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/list.gleam | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam index 680b0b0..7317242 100644 --- a/src/gleam/list.gleam +++ b/src/gleam/list.gleam @@ -1247,11 +1247,11 @@ fn do_take_while( acc: List(a), ) -> List(a) { case list { - [] -> acc + [] -> reverse(acc) [head, ..tail] -> case predicate(head) { True -> do_take_while(tail, predicate, [head, ..acc]) - False -> acc + False -> reverse(acc) } } } @@ -1268,5 +1268,4 @@ pub fn take_while( satisfying predicate: fn(a) -> Bool, ) -> List(a) { do_take_while(list, predicate, []) - |> reverse } |