From 48f544d2e3f70b19c82fe02ac56190b8204c44af Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 8 Feb 2008 11:48:06 +0000 Subject: [PATCH] * Function optionals. svn path=/nixpkgs/trunk/; revision=10553 --- pkgs/lib/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix index 2a8061d70bb..f6ce083d970 100644 --- a/pkgs/lib/default.nix +++ b/pkgs/lib/default.nix @@ -180,6 +180,10 @@ rec { # (e.g. `++ optional (system == "i686-linux") flashplayer'). optional = cond: elem: if cond then [elem] else []; + + # Return a list or an empty list, dependening on a boolean value. + optionals = cond: elems: if cond then elems else []; + # Return a list of integers from `first' up to and including `last'. range = first: last: