Associative array/Iteration: Difference between revisions

Line 2,760:
}
?></lang>
 
=={{header|Picat}}==
<lang Picat>go =>
Map = new_map([1=one,2=two,3=three,4=four]),
foreach(K=V in Map)
println(K=V)
end,
nl,
 
println(keys=Map.keys),
foreach(K in Map.keys.sort)
println(K=Map.get(K))
end,
nl,
 
println(values=Map.values),
foreach(V in Map.values.sort)
% This works but gets a warning: nonlocal_var_in_iterator_pattern
% println(V=[K : K=V in Map])
% No warning:
println(V=[K : K=V1 in Map,V1 == V])
end,
nl.</lang>
 
{{out}}
<pre>1 = one
2 = two
3 = three
4 = four
 
keys = [1,2,3,4]
1 = one
2 = two
3 = three
4 = four
 
values = [one,two,three,four]
four = [4]
one = [1]
three = [3]
two = [2]</pre>
 
 
=={{header|PicoLisp}}==
495

edits