Tables Reference

Version 4.11   (c) Jiri Babor   September 2002

Note: Types of variables are indicated by bold prefixes.


app
syntax:tmodified = app(table, okey, ovalue)
comment:append new entry, return modified table
see also:set, store

App
syntax:tmodified = App(table, skeysequence, ovalue)
comment:'deep', recursive app for nested tables
append value in table under new (last) key in keys sequence
return modified table
see also:app

dups
syntax:s = dups(table)
comment:returns sequence of all duplicate entries in table

ET
comment:constant, empty table, ET = {{}}
example:
sequence mytable

mytable = ET

fetch
syntax:ovalue = fetch(table, okey)
comment:return value of table element with specified key

Fetch
syntax:ovalue = Fetch(table, skeysequence)
comment:'deep' fetch : return value of element from nested table
the key sequence contains one key for every level, the
last one associated directly with the returned value
see also:fetch

index
syntax:i = index(table, okey)
comment:return key index, or zero if key is not found
frequently used to verify existence of an entry

join
syntax:table = join(table1, table2)
comment:combine table1 with table2
table2 is effectively attached to end of table1
return combined table

remove
syntax:tmodified = remove(table, okey)
comment:remove entry with the specified key, return modified table

set
syntax:tmodifiedtable = set(table, okey, onewvalue)
comment:replace specified table item with a new value
return modified table
see also:app, store

Set
syntax:tmodifiedtable = Set(table, skeysequence, onewvalue)
comment:'deep', recursive set for nested tables
replace specified table item with a new value
the key sequence contains one key for every level, the
value of the last one is replaced
return modified table
see also:set

store
syntax:tmodifiedtable = store(table, okey, ovalue)
comment:store value in table under given key
if matching key is found, corresponding value is replaced
otherwise new key as well as value are appended
return modified table
see also:app, set

tsort
syntax:tmodifiedtable = tsort(table)
comment:shell sort table by keys in ascending order