Associative array/Iteration: Difference between revisions
Content added Content deleted
(GP) |
|||
Line 1,650: | Line 1,650: | ||
{ForAll {Record.arity MyMap} Show} %% keys |
{ForAll {Record.arity MyMap} Show} %% keys |
||
{ForAll {Record.toList MyMap} Show} %% values</lang> |
{ForAll {Record.toList MyMap} Show} %% values</lang> |
||
=={{header|PARI/GP}}== |
|||
{{works with|PARI/GP|2.8.1+}} |
|||
The keys can be retried from a map with Vec: |
|||
<lang parigp>keys = Vec(M);</lang> |
|||
You can iterate over the values as usual: |
|||
<lang parigp>for(i=1,#keys, |
|||
print(keys[i]," ",mapget(M,keys[i])) |
|||
)</lang> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |