diff options
author | Jacek Galowicz <jacek@galowicz.de> | 2021-01-25 16:59:46 +0100 |
---|---|---|
committer | Jacek Galowicz <jacek@galowicz.de> | 2021-01-28 23:08:59 +0100 |
commit | 123045a57056b997165be4963cbf62120a967fec (patch) | |
tree | df971067e1c59e11fba585a121f060a3a49bd93d /doc/functions | |
parent | d9353519d70454b53c6c302205272ccac81e1b7f (diff) |
lib/attrsets: add cartesianProductOfSets function
Diffstat (limited to 'doc/functions')
-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> |