diff options
author | Marc Weber <marco-oweber@gmx.de> | 2010-04-17 18:26:40 +0000 |
---|---|---|
committer | Marc Weber <marco-oweber@gmx.de> | 2010-04-17 18:26:40 +0000 |
commit | 9e59164e5747235892f81ed6b6db67c63be89fe5 (patch) | |
tree | a5b25c73118a05a13fc46dbc3cb23dac6cbebc75 /pkgs/lib/lists.nix | |
parent | 36623b8227ea86869c99fe9a09c038eb5d1d74c7 (diff) | |
download | nixpkgs-9e59164e5747235892f81ed6b6db67c63be89fe5.tar nixpkgs-9e59164e5747235892f81ed6b6db67c63be89fe5.tar.gz nixpkgs-9e59164e5747235892f81ed6b6db67c63be89fe5.tar.bz2 nixpkgs-9e59164e5747235892f81ed6b6db67c63be89fe5.tar.lz nixpkgs-9e59164e5747235892f81ed6b6db67c63be89fe5.tar.xz nixpkgs-9e59164e5747235892f81ed6b6db67c63be89fe5.tar.zst nixpkgs-9e59164e5747235892f81ed6b6db67c63be89fe5.zip |
adding lib function haskell's drop x elements from head of list
svn path=/nixpkgs/trunk/; revision=21141
Diffstat (limited to 'pkgs/lib/lists.nix')
-rw-r--r-- | pkgs/lib/lists.nix | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pkgs/lib/lists.nix b/pkgs/lib/lists.nix index 6141ad413d3..9b8334a5b9d 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 |