Icon (programming Language) - Other Structures

Other Structures

Icon also allows the user to easily construct their own lists (or arrays):

aCat :=

The items within a list can be of any sort, including other structures. To quickly build larger lists, Icon includes the list generator; i := list(10, "word") generates a list containing 10 copies of "word".

Like arrays in other languages, Icon allows items to be looked up by position, e.g., weight := aCat.

The bang-syntax, e.g., every write(!aCat), will print out four lines, each with one element.

Icon includes stack-like functions, push and pop to allow them to form the basis of stacks and queues.

Icon also includes functionality for sets and tables (known as hashes, associative arrays, dictionaries, etc.):

symbols := table(0) symbols := 1 symbols := 2

This code creates a table that will use zero as the default value of any unknown key. It then adds two items into it, with the keys "there" and "here", and values 1 and 2.

Read more about this topic:  Icon (programming Language)

Famous quotes containing the word structures:

    If there are people who feel that God wants them to change the structures of society, that is something between them and their God. We must serve him in whatever way we are called. I am called to help the individual; to love each poor person. Not to deal with institutions. I am in no position to judge.
    Mother Teresa (b. 1910)

    The philosopher believes that the value of his philosophy lies in its totality, in its structure: posterity discovers it in the stones with which he built and with which other structures are subsequently built that are frequently better—and so, in the fact that that structure can be demolished and yet still possess value as material.
    Friedrich Nietzsche (1844–1900)