next up previous contents
Next: What You Should Up: Rules as Terms Previous: 2


The above rule in prefix form

But what about




Trying to rewrite in prefix form:

Note that the comma `,' in this expression is an argument separator. In the definition of happy/1 above, the commas are read as ``and''.



is also a compound term with principal functor

and arity 2. Since we have to represent three subgoals and the arity of `,' is 2 we again have a nested compound term. The correct prefix form for the example is:

Note: try the goal display((healthy(X),wealthy(X),wise(X))) to see the ``truth''. Also, note that, for a reason as yet unexplained, you need an extra pair of brackets around the goal you want printed via display/1.

Here is the tree:

Paul Brna
Mon May 24 20:14:48 BST 1999