* Function to return a range of numbers.

svn path=/nixpkgs/trunk/; revision=8850
This commit is contained in:
Eelco Dolstra 2007-06-09 19:45:55 +00:00
parent 6d58d51440
commit 9816367ed1

View file

@ -117,5 +117,12 @@ rec {
# (e.g. `++ optional (system == "i686-linux") flashplayer').
optional = cond: elem: if cond then [elem] else [];
# Return a list of integers from `first' up to and including `last'.
range = first: last:
if builtins.lessThan last first
then []
else [first] ++ range (builtins.add first 1) last;
}