[top] [up] [next]

Deleting instances


The operator del_obj/1 is used to remove one ore more class instances from the current module, this operator is a prefix operator. The operand of del_obj/1 can be a particular instance to which a variable contains a reference or a goal for a match. If the operand is a goal for a match then all instances are deleted that match with the goal. Below there are two examples of how del_obj/1 operator can be used.

  X new_obj stack, %Create and delete an instance
  X<-init,
  del_obj X.
  del_obj stack([], 0). %Delete all instances that match with the goal 'stack([], 0)'.

If the del_obj/1 operator cannot find any instances to delete it fails else if one or more instances are deleted it is successfully exited.

Like with normal prolog clauses the current database view is taken into account when deleting class instances.

[top] [up] [next]

 

info@trinc-prolog.com