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

svn path=/nixpkgs/trunk/; revision=21141
wip/yesman
Marc Weber 14 years ago
parent 36623b8227
commit 9e59164e57
  1. 5
      pkgs/lib/lists.nix

@ -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…
Cancel
Save