mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
roc format List.roc
This commit is contained in:
parent
f216224495
commit
4a371b9524
1 changed files with 2 additions and 2 deletions
|
@ -826,7 +826,7 @@ findFirstIndex = \list, matcher ->
|
|||
## If no satisfying element is found, an `Err NotFound` is returned.
|
||||
findLastIndex : List elem, (elem -> Bool) -> Result Nat [NotFound]*
|
||||
findLastIndex = \list, matches ->
|
||||
foundIndex = List.iterateBackwards list (List.len list) \prevIndex, elem ->
|
||||
foundIndex = List.iterateBackwards list (List.len list) \prevIndex, elem ->
|
||||
if matches elem then
|
||||
Break (prevIndex - 1)
|
||||
else
|
||||
|
@ -927,7 +927,7 @@ splitFirst = \list, delimiter ->
|
|||
when List.findFirstIndex list (\elem -> elem == delimiter) is
|
||||
Ok index ->
|
||||
before = List.sublist list { start: 0, len: index }
|
||||
after = List.sublist list { start: index + 1, len: List.len list - index - 1}
|
||||
after = List.sublist list { start: index + 1, len: List.len list - index - 1 }
|
||||
|
||||
Ok { before, after }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue