Create dict: Difference between revisions

462 bytes added ,  1 year ago
"Better category ordering, add redirects to categories, fix pseudo-adverb categories"
(add create dict page)
 
("Better category ordering, add redirects to categories, fix pseudo-adverb categories")
 
(7 intermediate revisions by 3 users not shown)
Line 1:
{{primitive|.x<br>x!y}}
 
The '''create dict''' primitive, takesa.k.a. two'''map''' listsconverts ofits equalargument(s) length and makesto a [[dictionary]] using the left argument as keys, and the right argument as the values.
 
==== K3 ====
Takes a an array of pairs and converts it to a dictionary.
<pre>
.((`a;10);(`b;20))
.((`a;10;)
(`b;20;))
</pre>
{{works in|Kona}}
 
==== K6+ ====
 
Takes two lists of equal length and makes a [[dictionary]] using the left argument as keys, and the right argument as the values.
Uniqueness of the keys is not enforced.
 
<pre>
Line 9 ⟶ 23:
4 5!6 7
</pre>
 
In k7, k9, and ngn/k, if <code>y</code> is an atom, it's extended to the length of <code>x</code>.
`a`b!2
`a`b!2 2
 
[[Category:Verbs]]
[[Category:Operator verbs]]
[[Category:Primitives]]
720

edits