removePrefix
lib.lists.removePrefix
Docs pulled from | This Revision | 10 minutes ago
Remove the first list as a prefix from the second list. Error if the first list isn't a prefix of the second list.
Inputs
list1
-
1. Function argument
list2
-
2. Function argument
Type
removePrefix :: [a] -> [a] -> [a]
Examples
lib.lists.removePrefix
usage example
removePrefix [ 1 2 ] [ 1 2 3 4 ]
=> [ 3 4 ]
removePrefix [ 0 1 ] [ 1 2 3 4 ]
=> <error>
Noogle detected
Implementation
The following is the current implementation of this function.
removePrefix =
list1: list2:
if hasPrefix list1 list2 then
drop (length list1) list2
else
throw "lib.lists.removePrefix: First argument is not a list prefix of the second argument";