make-instances-of-class-vectorInstance Retrievalmap-instances-on-space-instancesmap-instances-of-classGoTo Top

map-instances-of-class   function unit-classes-specifier[Function]

Apply a function once to each unit instance of the specified unit classes.

Package   :gbbopen

Module   :gbbopen-core

Arguments and values

function     A function designator specifying a function object of one argument
unit-classes-specifier     An extended unit-classes specification (see below)

Detailed syntax

unit-classes-specifier ::= t | single-unit-class-specifier | (single-unit-class-specifier+)

single-unit-class-specifier ::= atomic-unit-class | (atomic-unit-class subclassing-specifier)
atomic-unit-class ::= unit-class | unit-class-name
subclassing-specifier ::= :plus-subclasses | :no-subclasses | + | =

The shorthand + subclasses specifier is equivalent to :plus-subclasses and = to :no-subclasses.

The specified function is applied once to each unit instance of the specified unit classes, whether or not the instances reside on any space instances.

See also

Delete all unit instances of the unit class hyp:

  (map-instances-of-class #'delete-instance 'hyp)
Delete all unit instances of the unit class hyp and instances of subclasses of hyp:
  (map-instances-of-class #'delete-instance '(hyp :plus-subclasses))
or simply:
  (map-instances-of-class #'delete-instance '(hyp +))

The consequences are unspecified if an attempt is made to add or delete a unit instance while map-instances-of-class is in progress. There is one exception to this restriction: function may delete its unit instance argument, provided that deletion does not trigger the deletion of any other unit instances. For example, the following form intended to delete all space instances violates this restriction:

     '(standard-space-instance :plus-subclasses))
because deletion of a space instance with children automatically deletes those child space instances. The function delete-all-space-instances provides an efficient means of deleting all space instances without violating this rule.

The equivalent of (map-instances-of-class 'print arg) can be invoked using the REPL command

  :pic [unit-classes-specifier]
If arg is omitted, t is used as the default.

The GBBopen Project

make-instances-of-class-vectorInstance Retrievalmap-instances-on-space-instancesmap-instances-of-classGoTo Top