lib/attrsets: rename cartesianProductOfSets to cartesianProduct

Changed files
+10 -6
lib
+9 -5
lib/attrsets.nix
···
let
inherit (builtins) head length;
-
inherit (lib.trivial) mergeAttrs warn;
inherit (lib.strings) concatStringsSep concatMapStringsSep escapeNixIdentifier sanitizeDerivationName;
inherit (lib.lists) foldr foldl' concatMap elemAt all partition groupBy take foldl;
in
···
# Type
```
-
cartesianProductOfSets :: AttrSet -> [AttrSet]
```
# Examples
:::{.example}
-
## `lib.attrsets.cartesianProductOfSets` usage example
```nix
-
cartesianProductOfSets { a = [ 1 2 ]; b = [ 10 20 ]; }
=> [
{ a = 1; b = 10; }
{ a = 1; b = 20; }
···
:::
*/
-
cartesianProductOfSets =
attrsOfLists:
foldl' (listOfAttrs: attrName:
concatMap (attrs:
···
# DEPRECATED
zip = warn
"lib.zip is a deprecated alias of lib.zipAttrsWith." zipAttrsWith;
}
···
let
inherit (builtins) head length;
+
inherit (lib.trivial) isInOldestRelease mergeAttrs warn warnIf;
inherit (lib.strings) concatStringsSep concatMapStringsSep escapeNixIdentifier sanitizeDerivationName;
inherit (lib.lists) foldr foldl' concatMap elemAt all partition groupBy take foldl;
in
···
# Type
```
+
cartesianProduct :: AttrSet -> [AttrSet]
```
# Examples
:::{.example}
+
## `lib.attrsets.cartesianProduct` usage example
```nix
+
cartesianProduct { a = [ 1 2 ]; b = [ 10 20 ]; }
=> [
{ a = 1; b = 10; }
{ a = 1; b = 20; }
···
:::
*/
+
cartesianProduct =
attrsOfLists:
foldl' (listOfAttrs: attrName:
concatMap (attrs:
···
# DEPRECATED
zip = warn
"lib.zip is a deprecated alias of lib.zipAttrsWith." zipAttrsWith;
+
+
# DEPRECATED
+
cartesianProductOfSets = warnIf (isInOldestRelease 2405)
+
"lib.cartesianProductOfSets is a deprecated alias of lib.cartesianProduct." cartesianProduct;
}
+1 -1
lib/default.nix
···
zipAttrsWithNames zipAttrsWith zipAttrs recursiveUpdateUntil
recursiveUpdate matchAttrs mergeAttrsList overrideExisting showAttrPath getOutput
getBin getLib getDev getMan chooseDevOutputs zipWithNames zip
-
recurseIntoAttrs dontRecurseIntoAttrs cartesianProductOfSets
updateManyAttrsByPath;
inherit (self.lists) singleton forEach foldr fold foldl foldl' imap0 imap1
concatMap flatten remove findSingle findFirst any all count
···
zipAttrsWithNames zipAttrsWith zipAttrs recursiveUpdateUntil
recursiveUpdate matchAttrs mergeAttrsList overrideExisting showAttrPath getOutput
getBin getLib getDev getMan chooseDevOutputs zipWithNames zip
+
recurseIntoAttrs dontRecurseIntoAttrs cartesianProduct cartesianProductOfSets
updateManyAttrsByPath;
inherit (self.lists) singleton forEach foldr fold foldl foldl' imap0 imap1
concatMap flatten remove findSingle findFirst any all count