lst_to_pkg(K;V)
Returns a new package value by accepting a list of keys and a list of values of equal lengths.
Syntax
lst_to_pkg(K;V)
Input
Argument | Type | Description |
---|---|---|
K |
list-value | A list whose elements will be used as the keys in the new package Keys may only contain alphanumeric characters or underscores and must begin with an alphabetic character. They may not contain any spaces or other special characters. |
V |
list-value | A list whose elements will be used as the values in the new package Text values must be enclosed in single quotes. |
Return Value
Returns a package-value. Elements from list-value K
will be used as the
package keys. Elements from list-value V
will be used as package values.
If the lists specified to K
and V
have different lengths,
an error is returned.
If either K
or V
is N/A, an error is returned.
Example
In order to create a package-value using lst_to_pkg(K;V)
in the same line
as the comprising lists are declared, <letseq>
should be used.
<letseq keys="{lst('pi' 'vowels' 'existence')}" vals="{lst(3.14159 lst('a' 'e' 'i' 'o' 'u') 'To be or not to be') }"> <set important_ideas="{lst_to_pkg(@keys;@vals)}"/> <colord cols="store"/> <willbe name="pi" value="'{@important_ideas['pi']}'"/> </letseq>
Example: Using in blocks
In order to use lst_to_pkg(K;V)
in a block, use <set>
after the opening tag of the <block>
element:
<block name="test_pkg" keys="{lst('pi' 'vowels' 'existence')}" vals="{lst(3.14159 lst('a' 'e' 'i' 'o' 'u') 'To be or not to be') }"> <set important_ideas="{lst_to_pkg(@keys;@vals)}"/> <colord cols="store"/> <willbe name="test" value="'{@important_ideas['pi']}'"/> <willbe name="secondvowel" value="'{@important_ideas.vowels.2}'"/> </block>