2.14 table
(require sicm/general/table) | package: rktsicm |
2.14.1 Tables
procedure
(make-table name assoc) → table
name : any/c assoc : (-> any/c (listof (pair? any/c any/c)) (or/c #f (pair? any/c any/c)))
Create an empty (multidimensional) table. A table is defined as an object-like function.
procedure
table : table keys : any/c
procedure
table : table val : any/c keys : any/c
procedure
(add-to-list! obj table keys ...) → any/c
obj : any/c table : table keys : any/c
procedure
(adjoin-to-list! obj table keys ...) → any/c
obj : any/c table : table keys : any/c
Retrieve and put objects in the table.
2.14.2 AList tables
2.14.3 PList tables
procedure
(default-lookup key default table) → any/c
key : any/c default : any/c table : (listof any/c)
Traverse the the property-list table, which is a list where the even-numbered items are keys, and odd-numbered items are the values.
For the first item that is eq? to the key, return the next item in the list. If no corresponding item is found, the default argument is returned.
From a list of keys and a list of vals generate a procedure that takes a key and gives the corresponding val. The vals list should be at least as long as the keys list.
The first item in the keys list that is the same according to same? will give the corresponding item from the vals list.