array

Gamma: Version 4.0
Prev |  | Next

# `array`

`array` -- constructs an array.

## Syntax

    array (s_exp?...)

## Arguments

`s_exp`

  Any Gamma or Lisp expression.

## Returns

An array containing all of the arguments.

## Description

An array is represented as a sequence of objects surrounded by square brackets, as in [1 2 a (4 5)]. The objects within the brackets are not evaluated. To refer to or access an array, it must be assigned to a symbol.

This function constructs an array of all of the arguments, in the order given. The arguments are evaluated when the `array` function is called, but once the array has been constructed the array objects are not evaluated.

It is possible to create an empty array, and fill it later. It will expand as necessary when array objects are added.

## Example

        Gamma> array(#a, 5, nil, 4 + 3, "goodbye");
        [a 5 nil 7 "goodbye"]
        Gamma> y = array(5 * 2, #symbol, 432, "string", nil);
        [10 symbol 432 "string" nil]
        Gamma> z = array(#c, y);
        [c [10 symbol 432 "string" nil]]
        Gamma> x = array();
        []
        Gamma> x[5] = 19;
        19
        Gamma> x;
        [nil nil nil nil nil 19]
        Gamma>

See the The Monitor Window section of the Photon Functions chapter in the Cogent Tools Demo and Tutorials book for an example of this function used in context.

## See Also

`aset`, `aref`, `insert`, `delete`, `sort`

Prev | Home | Next
`aref` | Up | `array_to_list`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.