Search                        Top                                  Index
HELP APPDATA                             Revised: John Williams Apr 1985
                                         Revised: Adrian Howard Mar 1992

    appdata(struct, p)

This procedure takes two arguments, some kind of data structure struct
and a procedure p. It applies the procedure to each component of the
structure. For example, the following

    appdata('CAT', charout);

applies charout to the elements of the string 'CAT' (the characters `C`,
`A`, `T`.) These characters, therefore, will appear as output.

Another example:

    appdata({a 2 'foo'}, dataword) =>
    ** word integer string

If the structure argument to appdata is a property the procedure is
applied to each of the item/value pairs (to each element of its
datalist).

If the structure argument to appdata is a closure, the procedure is
applied to the frozen values.

If the structure argument to appdata is an array, the procedure is
applied to all the elements of the array.

See HELP * DATALIST for more examples of what the components of various
kinds of structures are taken to be.

N.B. If appdata is applied to a list, then the procedure will be applied
to the front of the list and to the back of the list, not to all the
elements of the list. To understand why, you need to understand how
lists are implemented. See TEACH * WAL (What Are Lists). The procedure
applist is provided to apply a procedure to every element of a list (see
REF * APPLIST.)


See Also
--------

HELP * DATALIST
    Returns a list of the components of a structure.

HELP * MAPDATA
    Like appdata, but returns a changed copy of the structure.

HELP * CLASSES
    More on data structures and procedures applicable to them.

HELP * LOOPS
    Other types of iteration.

REF * DATA
    Details on generic data procedures.


--- C.all/help/appdata
--- Copyright University of Sussex 1992. All rights reserved.