adding lib function haskell's drop x elements from head of list

svn path=/nixpkgs/trunk/; revision=21141
This commit is contained in:
Marc Weber 2010-04-17 18:26:40 +00:00
parent 36623b8227
commit 9e59164e57

View file

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