1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

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