diff --git a/pkgs/lib/lists.nix b/pkgs/lib/lists.nix index b186e97a55b..8ac93476a53 100644 --- a/pkgs/lib/lists.nix +++ b/pkgs/lib/lists.nix @@ -4,6 +4,12 @@ rec { inherit (builtins) head tail isList; + # Create a list consisting of a single element. `singleton x' is + # sometimes more convenient with respect to indentation than `[x]' + # when x spans multiple lines. + singleton = x: [x]; + + # "Fold" a binary function `op' between successive elements of # `list' with `nul' as the starting value, i.e., `fold op nul [x_1 # x_2 ... x_n] == op x_1 (op x_2 ... (op x_n nul))'. (This is