HELP NEWSPARSE                    Jonathan Laventhol, 18 October 1984.

NEWSPARSE(<integer>) -> <sparse_array>

    This is a library procedure for making sparse arrays -- data
structures which are just like ordinary arrays, except that they
save space when most of the points in the array have the same thing.
(See HELP *ARRAYS)

It takes an argument which is an integer specifying how many
dimensions the array should have.

(As explained in HELP * NEWANYSPARSE, instead of an integer, a list
of integers can be given, specifying for each dimension approximately
how many entries there will be).

Examples of use:

    Suppose you want a sparse array of three dimensions:

    ;;; make it
        vars sa;
        newsparse(3) -> sa;

    ;;; this is how it prints
        sa =>
        ** <procedure sparse_array>

    ;;; this is what is in each cell
        sa(1,2,3) =>
        ** undef

    ;;; change one of the cells
        [one two three] -> sa(1,2,3);
        sa(1,2,3) =>
        ** [one two three]

    Sparse arrays are very similar to ordinary arrays except that they
take up much less space.  An ordinary array reserves space for every
possible element.  A sparse array only takes up space for the cells
which aren't the default value. So if you want a huge array to
represent, for example, places in the world at a given time;

        newsparse(4) -> universe;
        [event explosion] -> universe(10, 100, 1000, 1200);

    Sparse arrays can also have ANY pop object as the subscripts.  So we
could make an array of words for different animals.  It might be used
like this:

        wordfor("animal", 4, "domestic", "ungulate", "male") =>
        ** bull

    The procedure newsparse is defined in terms of *NEWANYSPARSE, which
is more general; it provides for different kinds of default and control
of the amount of space it takes up.

See also:
HELP * PROPERTIES, * NEWPROPERTY, * NEWSPARSE, * NEWANYPROPERTY
REF * PROPS


The last example in * NEWANYPROPERTY illustrates a different technique,
employing a single property table.

-----<Copyright University of Sussex 1986.  All rights reserved.>-------
