Associative array/Creation: Difference between revisions

→‎Insitux: implementation
(→‎Insitux: implementation)
Line 3,439:
say "'baz' => [V].";
end the story.</syntaxhighlight>
 
=={{header|Insitux}}==
 
It is possible to use any value type for both keys and values for a dictionary in Insitux.
 
<syntaxhighlight lang="insitux">{
:a "value" ;keyword key, string value
:b 123 ;keyword key, number value
456 [1 2 3] ;number key, vector value
[5 6 7] :b ;vector key, keyword value
{:a 1} {:b 2} ;dictionary key, dictionary value
}</syntaxhighlight>
 
<syntaxhighlight lang="insitux">;use dictionary as function for lookup; commas for readability, treated as white-space
> ({:a 1, :b 2, :c 3} :b)
2</syntaxhighlight>
 
<syntaxhighlight lang="insitux">;extend existing dictionary by using it as a function with two arguments
> ({:a 1, :b 2, :c 3} :b 3)
{:a 1, :b 3, :c 3}</syntaxhighlight>
 
=={{header|Ioke}}==
112

edits