Hash from two arrays: Difference between revisions

(Added Yabasic)
 
(One intermediate revision by the same user not shown)
Line 1,303:
=={{header|langur}}==
=== the easy way ===
<syntaxhighlight lang="langur">writeln(hash wfw/a b c d/, [1, 2, 3, 4])</syntaxhighlight>
</syntaxhighlight>
 
Note that wfw/a b c d/ is a semantic convenience equivalent to ["a", "b", "c", "d"].
 
=== a longer way ===
Using the append operator would silently overwrite hash values for matching keys, but the more() function will not.
<syntaxhighlight lang="langur">val .new = foldfrom(
ffn(.hash, .key, .value) more .hash, h{.key: .value},
h{}hash(), wfw/a b c d/, [1, 2, 3, 4],
)
 
Line 1,317 ⟶ 1,318:
 
{{out}}
<pre>h{"d": 4, "a": 1, "b": 2, "c": 3}</pre>
 
=={{header|Lasso}}==
890

edits