:THE-INSTANCE

Purpose

Either finds exactly one instance with the given properties, or else creates one with those properties.

Parameters

(variable class)
A variable to be bound to the found or new instance and the class of that instance.
clause*
Clauses to be asserted about the new instance. If a (:NAME ...) clause is included, the new instance will be created with the name given in that clause.

Examples

  (:THE-INSTANCE (?t1 Trucks) (:NAME ?t1 "F-150"))
  (:THE-INSTANCE (?mycat Cats)  (:NAME ?mycat "Shadow") (enemyOf ?mycat Rover))

Success criteria

Succeeds if exactly one instance is found or successfully created.

Failure criteria

Fails if an instance can not be found or created.

Notes

The class of the new instance must already exist.

If an instance with the stated properties can not be found, this command is equivalent to :ADD-INSTANCE.

Related commands


Back to...

Algernon commands
Algernon Documentation Central
Algernon home page