aboutsummaryrefslogtreecommitdiff
path: root/lib/lists.nix
diff options
context:
space:
mode:
authorEdward Tjörnhammar <ed@cflags.cc>2014-09-16 18:03:46 +0200
committerEdward Tjörnhammar <ed@cflags.cc>2014-09-16 18:12:39 +0200
commit2bbd01485a73b0b23da77efa46212d1f833b5efb (patch)
tree6258a1d94467928ebbd35158a58bc08d3a52a76e /lib/lists.nix
parent6110679beeb0a88da65d517d2d79277151dd7798 (diff)
init list helper
Diffstat (limited to '')
-rw-r--r--lib/lists.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/lists.nix b/lib/lists.nix
index 4b5f04a67585..af70faacbcd7 100644
--- a/lib/lists.nix
+++ b/lib/lists.nix
@@ -209,6 +209,10 @@ in rec {
assert list != []; elemAt list (dec (length list));
+ # Return all elements but the last
+ init = list: assert list != []; take (length list - 1) list;
+
+
# Zip two lists together.
zipTwoLists = xs: ys:
let