drop
lib.drop
Docs pulled from | This Revision | 28 minutes ago
Nixpkgs manual
Remove the first (at most) N elements of a list.
Inputs
count-
Number of elements to drop
list-
Input list
Type
drop :: Int -> [a] -> [a]
Examples
lib.lists.drop usage example
drop 2 [ "a" "b" "c" "d" ]
=> [ "c" "d" ]
drop 2 [ ]
=> [ ]
Noogle detected
Implementation
The following is the current implementation of this function.
drop =
count: list:
let
len = length list;
in
genList (n: elemAt list (n + count)) (if count > len then 0 else len - count);