3
0
Fork 0
forked from mirrors/nixpkgs

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

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;
}