From a794e90f004df3ec16279d0781b5f960a84c5e1f Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Thu, 26 Dec 2024 16:12:28 +0100 Subject: [PATCH] doc: improve lib.compareLists documentation --- lib/lists.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/lists.nix b/lib/lists.nix index ca436d7a9c94b5..6b63645a2758be 100644 --- a/lib/lists.nix +++ b/lib/lists.nix @@ -1330,7 +1330,13 @@ rec { pairs); /** - Compare two lists element-by-element. + Compare two lists element-by-element with a comparison function `cmp`. + + List elements are compared in order, the first non-equal pair of elements determines the result. + + With `cmp := (a: b: a < b)`, the result is the same as comparing `a < b` directly. + Therefore `compareLists` is a generalization of the `<` operator with a customizable comparison function. + See also https://nix.dev/manual/nix/stable/language/operators#comparison for more information. # Inputs