On the other hand, if bb_def/3 or bb_set/3 is used to name objects on the
blackboard, they "survive" backtracking and can afterwards be retrieved as
logical variables using bb_val/3
.
bb_def/3 (i,i,i) defines a value bb_set/3 (i,i,i) updates a value bb_rm/2 (i,i) removes a value bb_val/3 (i,i,o) retrieves the value
They are quite close to the recorda/recordz family of other Prologs although they offer better 2-key indexing, are simpler and can be used to do much more things efficiently.
You can look to the program progs/knight.pl on how to use them to implement in a convenient and efficient way programs with backtrackable global arrays.
They can be used to save information that survives backtracking in a way similar to other Prolog's assert and retract and are safe with respect to garbage collection of the blackboard.
The predicate bb_list/1 gives the content of the blackboard as a heap object (list), while bb/0 simply prints it out.
These predicates offer generally faster and more flexible management of dynamic state information than other Prolog's dynamic databases.