diff options
author | Silvan Mosberger <contact@infinisil.com> | 2021-01-29 20:22:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-29 20:22:12 +0100 |
commit | aa48e205a2e0516ff4b96c79eeb666aaaccd418c (patch) | |
tree | 4e8f6542985139c8e498057dcbdbfd6fea0c3648 /doc | |
parent | 417b19df406ae6106d80a6c551787cd13d0299dd (diff) | |
parent | 577d58a8e01aead5eb237d39a6d7df1fb7aa00c4 (diff) |
Merge pull request #110787 from tfc/cartesian-product
lib/attrsets: add cartesianProductOfSets function
Diffstat (limited to 'doc')
-rw-r--r-- | doc/functions/library/attrsets.xml | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/doc/functions/library/attrsets.xml b/doc/functions/library/attrsets.xml index 3c5823c25891..7ef0d16624c8 100644 --- a/doc/functions/library/attrsets.xml +++ b/doc/functions/library/attrsets.xml @@ -1711,4 +1711,43 @@ recursiveUpdate </example> </section> + <section xml:id="function-library-lib.attrsets.cartesianProductOfSets"> + <title><function>lib.attrsets.cartesianProductOfSets</function></title> + + <subtitle><literal>cartesianProductOfSets :: AttrSet -> [ AttrSet ]</literal> + </subtitle> + + <xi:include href="./locations.xml" xpointer="lib.attrsets.cartesianProductOfSets" /> + + <para> + Return the cartesian product of attribute set value combinations. + </para> + + <variablelist> + <varlistentry> + <term> + <varname>set</varname> + </term> + <listitem> + <para> + An attribute set with attributes that carry lists of values. + </para> + </listitem> + </varlistentry> + </variablelist> + + <example xml:id="function-library-lib.attrsets.cartesianProductOfSets-example"> + <title>Creating the cartesian product of a list of attribute values</title> +<programlisting><![CDATA[ +cartesianProductOfSets { a = [ 1 2 ]; b = [ 10 20 ]; } +=> [ + { a = 1; b = 10; } + { a = 1; b = 20; } + { a = 2; b = 10; } + { a = 2; b = 20; } + ] +]]></programlisting> + </example> + </section> + </section> |