Associative array/Creation: Difference between revisions

Line 1,286:
=={{header|Scheme}}==
 
Scheme has association lists (alists), which are inefficient, ordered maps with arbitrary keys and values. Hash tables are provided by SRFI-69 [http://srfi.schemers.org/srfi-69/srfi-69.html]. Many Scheme implementation also provide native hash tables.
<lang scheme>(define my-alistdict '((a b) (1 hello) ("c" (a b c)))
(assoc 'a my-dict) ; evaluates to 'b</lang>
 
 
<lang scheme>
Hash tables are provided by SRFI-69 [http://srfi.schemers.org/srfi-69/srfi-69.html]. Many Scheme implementation also provide native hash tables.
(define my-alist '((a b) (1 hello) ("c" (a b c)))
 
(define my-hash (alist->hash-table my-alist))
<lang scheme>(define my-alist '((a b) (1 hello) ("c" (a b c)))
</lang>
(define my-hash (alist->hash-table my-alist))</lang>
 
=={{header|Seed7}}==
Anonymous user