diff --git a/pkgs/lib/lists.nix b/pkgs/lib/lists.nix index 785e47e7d52..d032ab412ba 100644 --- a/pkgs/lib/lists.nix +++ b/pkgs/lib/lists.nix @@ -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; }