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:

    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)

    The American who has been confined, in his own country, to the sight of buildings designed after foreign models, is surprised on entering York Minster or St. Peter’s at Rome, by the feeling that these structures are imitations also,—faint copies of an invisible archetype.
    Ralph Waldo Emerson (1803–1882)