Jump to content

Associative array/Iteration: Difference between revisions

→‎{{header|TXR}}: Dop @(do ...), remove spurious argument in [h k nil], streamline.
m (→‎{{header|Sidef}}: removed the useless semicolons)
(→‎{{header|TXR}}: Dop @(do ...), remove spurious argument in [h k nil], streamline.)
Line 2,414:
=={{header|TXR}}==
 
<lang txrtxrlisp>(defvarl h (hash))
@(do (defvar *h* (make-hash nil nil nil))
(each ((k '(a b c))
(v '(1 2 3)))
(set [*h* k nil] v))
(dohash (k v *h*)
(format t "~a -> ~a\n" k v))))</lang>
 
(each ((k '(a b c))
<pre>$ txr hash.txr
(v '(1 2 3)))
(set [*h* k nil] v))
 
(dohash (k v *h*)
(put-line `@k -> @v`))</lang>
 
{{out|Run}}
 
<pre>$ txr hash.txrtl
c -> 3
b -> 2
543

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.