Hash from two arrays: Difference between revisions

Content added Content deleted
(Add WDTE example.)
(added langur language example)
Line 818: Line 818:
<lang lang5>: >table 2 compress -1 transpose ;
<lang lang5>: >table 2 compress -1 transpose ;
['one 'two 'three 'four] [1 2 3 4] >table</lang>
['one 'two 'three 'four] [1 2 3 4] >table</lang>

=={{header|Langur}}==
=== the easy way ===
<lang Langur>writeln toHash ["a", "b", "c", "d"], [1, 2, 3, 4]</lang>

=== a longer way ===
<lang Langur>val .new = foldfrom(
f(.hash, .key, .value) .hash ~ h{.key: .value},
h{},
["a", "b", "c", "d"],
[1, 2, 3, 4],
)

writeln .new</lang>

{{out}}
<pre>h{"d": 4, "a": 1, "b": 2, "c": 3}</pre>


=={{header|LFE}}==
=={{header|LFE}}==