make dropFirst and dropLast drop n elements

This commit is contained in:
Isaac Van Doren 2023-10-29 13:23:33 -05:00
parent cb6b36e218
commit 139d3c6f89
No known key found for this signature in database
GPG key ID: CFA524CD470E5B94
48 changed files with 3518 additions and 3470 deletions

View file

@ -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}]

View file

@ -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