mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
make dropFirst and dropLast drop n elements
This commit is contained in:
parent
cb6b36e218
commit
139d3c6f89
48 changed files with 3518 additions and 3470 deletions
|
@ -28,7 +28,7 @@ Linear := {} implements [MDecoderFormatting {u8}]
|
|||
u8 = @MDecoder \lst, @Linear {} ->
|
||||
#^^{-1} Linear#u8(11): MDecoder U8 Linear
|
||||
when List.first lst is
|
||||
Ok n -> { result: Ok n, rest: List.dropFirst lst }
|
||||
Ok n -> { result: Ok n, rest: List.dropFirst lst 1 }
|
||||
Err _ -> { result: Err TooShort, rest: [] }
|
||||
|
||||
MyU8 := U8 implements [MDecoding {decoder}]
|
||||
|
|
|
@ -5,7 +5,7 @@ Parser a : List U8 -> List [Pair a (List U8)]
|
|||
any: Parser U8
|
||||
any = \inp ->
|
||||
when List.first inp is
|
||||
Ok u -> [Pair u (List.drop inp 1)]
|
||||
Ok u -> [Pair u (List.dropFirst inp 1)]
|
||||
_ -> []
|
||||
|
||||
main = any
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue