Add the reverseList function.

svn path=/nixpkgs/trunk/; revision=17676
This commit is contained in:
Nicolas Pierron 2009-10-06 13:36:46 +00:00
parent 730c14b4b7
commit e528b920bb
1 changed files with 6 additions and 0 deletions

View File

@ -136,4 +136,10 @@ rec {
zipLists = zipListsWith (fst: snd: { inherit fst snd; });
# invert the order of the elements of a list.
reverseList = l:
let reverse_ = accu: l:
if l == [] then accu
else reverse_ ([(head l)] ++ accu) (tail l);
in reverse_ [] l;
}