:-(happy(X),rich(X)). [-5pt]But what about
happy(X):-Trying to rewrite in prefix form:healthy(X),
wealthy(X),
wise(X).
:-(happy(X),whatgoeshere?). [-5pt]Note that the comma `,' in this expression is an argument separator. In the definition of happy/1 above, the commas are read as ``and''.
Yes,
healthy(X),wealthy(X),wise(X). [-5pt]is also a compound term with principal functor
, [-5pt]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:
'
,'
(healthy(X),'
,'
(wealthy(X),wise(X))).
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: