From 9e59164e5747235892f81ed6b6db67c63be89fe5 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Sat, 17 Apr 2010 18:26:40 +0000 Subject: adding lib function haskell's drop x elements from head of list svn path=/nixpkgs/trunk/; revision=21141 --- pkgs/lib/lists.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/lib/lists.nix b/pkgs/lib/lists.nix index 6141ad413d36..9b8334a5b9df 100644 --- a/pkgs/lib/lists.nix +++ b/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 -- cgit 1.4.1