Tables

From Impure Wiki

Jump to: navigation, search

basic lists structures: Table, NumberTable

Tables are Lists of Lists.

By convention, Table’s Lists are interpreted as columns. The fact of a Table being a List might be confusing for those who are used to work with tables as excel sheets. In excel, columns and rows are treated as equals. In Impure Tables, rows doesn’t exists a priori! (off course they can be obtained -generated-).

So, if you want to obtain a specific list (a column) there’s no getListFromTable operator, instead you have to use getElementFromList, because Tables are Lists!

This scheme reveals the structure of a Table, and put it clear that a Table is a List of Lists:

ListOfLists.png

The image clearly shows that a Table may have Lists of different lengths. This might not be the most common case, but could happen.

Use the TableAtAGlance for quickly visualize the structure of a Table and its contents.


TableAtAGlance.png


Some basic and useful operators for Tables:

getElementFromList to obtain a List (column) from a Table getSubList to obtain a sub-Table

and any List opertor is, off course, allowed to be used with Table.


more specific operators for Tables: getRow getElementFromTable obtaining sub-Tables from a Table

You might want to filter a Table: to create a new Table with only some Lists of the original, some rows, perhaps a cropping of the original Table, or a combination of these.

There are many ways to obtain sub-Tables from a Table. Take a look on the example: basic/tables/filterig_tables.

Filtering tables.png


pairs Tables

A Table with at least two Lists of the same length is a pair Table). A pair, in this case, is coformed by two elements in the same row, in the first and second Lists. Many processes can be done with this kind of tables, for instance:

- create a Network (relations are determined by pairs)

- count pairs repetitions

- define a replacement rule, in which each pair indicates which element should be replaced by which one.

Personal tools