suivant: Usual matrix monter: The CAS functions précédent: Statistic functions : mean,variance,stddev,   Table des matières   Index

# Table with string as index : table

A table is an associative container (or map), it is used to store informations associated to indexes which are much more general than integers, like strings or sequences. It may be used for example to store a table of phone numbers indexed by names.
In Xcas, the indexes in a table may be any kind of Xcas objects. Access is done by a binary search algorithm, where the sorting function first sorts by type then uses an order for each type (e.g. < for numeric types, lexicographic order for strings, etc.)
table takes as argument a list or a sequence of equalities index_name=element_value.
table returns this table.
Input :
T:=table(3=-10,"a"=10,"b"=20,"c"=30,"d"=40)
Input :
T["b"]
Output :
20
Input :
T[3]
Output :
-10
Remark
If you assign T[n]:= ... where T is a variable name and n an integer
• if the variable name was assigned to a list or a sequence, then the n-th element of T is modified,
• if the variable name was not assigned, a table T is created with one entry (corresponding to the index n). Note that after the assignation T is not a list, despite the fact that n was an integer.

suivant: Usual matrix monter: The CAS functions précédent: Statistic functions : mean,variance,stddev,   Table des matières   Index
giac documentation written by Renée De Graeve and Bernard Parisse