23 lines
620 B
Plaintext
23 lines
620 B
Plaintext
;;; Create expandable hash table of initial size 50 and with default
|
|
;;; value 0 (default value is returned when the item is absent).
|
|
vars ht = newmapping([], 50, 0, true);
|
|
;;; Set value corresponding to string 'foo'
|
|
12 -> ht('foo');
|
|
;;; print it
|
|
ht('foo') =>
|
|
;;; Set value corresponding to vector {1 2 3}
|
|
17 -> ht({1 2 3});
|
|
;;; print it
|
|
ht({1 2 3}) =>
|
|
;;; Set value corresponding to number 42 to vector {0 1}
|
|
{0 1} -> ht(42);
|
|
;;; print it
|
|
ht(42) =>
|
|
|
|
;;; Iterate over keys printing keys and values.
|
|
appproperty(ht,
|
|
procedure (key, value);
|
|
printf(value, '%p\t');
|
|
printf(key, '%p\n');
|
|
endprocedure);
|