Associative array/Iteration: Difference between revisions
Content added Content deleted
(→{{header|MATLAB}} / {{header|Octave}}: more concise explanation) |
(→{{header|TXR}}: With "each" operator and array syntax.) |
||
Line 1,293: | Line 1,293: | ||
<lang txr> |
<lang txr> |
||
@(do (defvar *h* (make-hash nil nil nil)) |
@(do (defvar *h* (make-hash nil nil nil)) |
||
( |
(each ((k '(a b c)) |
||
(v '(1 2 3))) |
|||
(set [*h* k nil] v)) |
|||
'(1 2 3)) |
|||
(dohash (k v *h*) |
(dohash (k v *h*) |
||
(format t "~a -> ~a\n" k v)))</lang> |
(format t "~a -> ~a\n" k v))))</lang> |
||
<pre>$ txr hash.txr |
<pre>$ txr hash.txr |