24.11.2014 Views

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

9. Flex Predicates 141<br />

<strong>flex</strong> toolkit<br />

new_default( colour, albino, white ).<br />

new_demon( +Name,?Attribute,?Frame,?Old,?New,+Context,+Action )<br />

Create (or update if the Name already exists) a demon which reacts to slot<br />

updates (see new_slot/3).<br />

The Action (a Prolog call) is initiated whenever the Attribute of the<br />

Frame changes from some Old value (the atom unknown if there is no<br />

current value) to some New value.<br />

In addition, the Context (a Prolog call) must also hold before the demon<br />

can be activated.<br />

The Action (a Prolog call) occurs immediately after the update, and will<br />

therefore not affect the update itself.<br />

Examples<br />

new_demon(spying_slots, Attribute, Frame,<br />

Old, New, true,<br />

( write(Attribute(Frame) = (Old-->New)), nl )<br />

)<br />

new_demon( check_meltdown, global, temperature, _, T,<br />

comparison(>,T,boiling_point),<br />

( remember_fact(danger_level(red)), shut_down<br />

) )<br />

new_frame( +Name,+Parents )<br />

A new frame called Name is created whose position in the frame hierarchy is<br />

determined by its list of Parents. These Parents determine from where<br />

values can be inherited.<br />

Examples<br />

new_frame( animal, [] ) .<br />

new_frame( mammal, [animal] ) .<br />

new_frame( whale, [mammal,ocean_dweller] ) .<br />

new_function( +Name, +Arguments, +Value )<br />

Record the definition of a function Name. Functions are evaluated at runtime<br />

through calls to dereference/2.<br />

Example<br />

new_function( father, [X], (Y : (parent(X,Y),male(Y)))<br />

) .

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!