Hash from two arrays: Difference between revisions

Line 1,303:
=={{header|langur}}==
=== the easy way ===
<syntaxhighlight lang="langur">writeln(hash hash(fw/a b c d/, [1, 2, 3, 4])
</syntaxhighlight>
 
Line 1,310:
=== 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(
val new = foldfrom(
fn(.hash, .key, .value) more .hash, {.key: .value},
hash(), fw/a b cfn d/h, [1key, 2value:more(h, 3,{key: 4]value}),
{:}, fw/a b c d/, [1, 2, 3, 4],
)
writeln new
 
writeln .new</syntaxhighlight>
 
{{out}}
1,007

edits