Search                        Top                                  Index
HELP CLASSES                            Updated A. Sloman Aug 1986

POP-11 has a number of built in data classes including integers,
decimals, words, strings, booleans, procedures, closures, vectors,
arrays, processes, references, pairs (used for lists), nil (the empty
list), and termin. See REF * DATA for a complete list.

Each data type has a "KEY" associated with it. The key is a record that
contains information about the class, including procedures associated
with the class.

"Vector" type data-structures have components that are accessed or
updated by numerical subscripts, whereas "record" type data-structures
have field selector/updater procedures. There are several types of
vector classes (e.g. ordinary vectors and strings) and several types of
record classes, e.g. pairs and references.

The procedure * CONSKEY enables a new class of vectors or a new class of
records to be created by the user, but normally it is more convenient to
use syntax constructs that invoke CONSKEY.

REF * DEFSTRUCT explains how to create new classes of records and
vectors easily.

For full details of what classes are see REF *KEYS.


The following procedures access or update components of the key
associated with a class.

class_=(key) -> procedure
procedure -> class_=(key)
    Returns the equality testing procedure for objects of the class.
    This is user-assignable, the default being sys_=

class_access(n, key) -> procedure
    Given a record class key, returns the n'th accessing procedure.

class_apply(key) -> procedure
procedure -> class_apply(key)
    Returns/updates a procedure that specifies how to "apply" objects of
    the given class, i.e. what to do if the object is applied. For
    vector type keys, this defaults to the subscriptor procedure,
    hence VEC(5) is equivalent to SUBSCRV(5, VEC). Because it is
    user-assignable, users can create new types of procedure objects.

class_cons(key) -> procedure
    Returns a procedure for constructing items of the given class.

class_datasize(key)-> n
    Given a record type key, returns the length in longwords of records
    of that class.

class_dataword(key) -> word
    Given a key returns the associated dataword

class_dest(key) -> procedure
    Returns the 'destructor', or 'exploder' for that class.

class_hash(key) -> procedure
procedure -> class_hash(key)
    Returns/updates the hash function for the class, invoked by SYSHASH.

class_init(key) -> procedure
    Given a vector type class key, returns the initialiser procedure.

class_print(key) -> procedure
procedure -> class_print(key)
    Returns/updates the procedure used by *SYSPR to print items from the
    class. The default is *SYS_SYSPR, but can be changed.

class_recognise(key) -> procedure
    Returns a procedure that recognises members of the class

class_spec(key) -> specification
    For a vector key returns the field size.
    For a record type key returns the list of field specifiers.
    For any other time returns false.

class_subscr(key) -> procedure
    For a vector-type key returns the subscripting procedure.

class_fast_subscr(key) -> procedure
    Like class_subscr, but returns a non-checking subscriptor procedure,
    to be used with caution. (See REF * FASTPROCS)


The following procedures also operate on or are associated with keys:

conskey(word,specification) -> key
    Creates a key, and hence a new class.
    For a vector class the specification should be either the word
    "full" or a positive or negative integer.
    For a record class the specification is a list of field sizes.

datakey(item) -> key
    Given any item returns the key for the class containing the item

iskey(item) -> boolean
    Recogniser for keys

key_of_dataword(word) -> key
    Given a word which is a dataword return the corresponding KEY. This
    is a property, initialised for built in keys, and updated by

See also HELP * KEYS and the following documentation for procedures that
operate on data-structures:

    *APPDATA    - apply a procedure to every element of a structure
    *COPY       - copy a data-structure
    *COPYDATA   - a recursive data-structure copier
    *DATAFILE   - store data-structures in a disk file.
    *DATALIST   - form a list of components of a structure
    *EXPLODE    - put all the elements of a structure on the stack
    *FILL       - copy the top elements of the stack into a structure
    *MAPDATA    - transform elements of a structure via a proceure
    *RECORDCLASS - create new record classes
    *VECTORCLASS - create new vector classes

--- C.all/help/classes -------------------------------------------------
--- Copyright University of Sussex 1988. All rights reserved. ----------