forked from mirrors/nixpkgs
adding lib function haskell's drop x elements from head of list
svn path=/nixpkgs/trunk/; revision=21141
This commit is contained in:
parent
36623b8227
commit
9e59164e57
|
@ -167,6 +167,11 @@ rec {
|
|||
if list == [] || count == 0 then []
|
||||
else [ (head list) ] ++ take (builtins.sub count 1) (tail list);
|
||||
|
||||
# haskell's drop. drop count elements from head of list
|
||||
drop = count: list:
|
||||
if count == 0 then list
|
||||
else drop (builtins.sub count 1) (tail list);
|
||||
|
||||
last = list:
|
||||
assert list != [];
|
||||
let loop = l: if tail l == [] then head l else loop (tail l); in
|
||||
|
|
Loading…
Reference in a new issue