It would be interesting to see the complete code. with All definitions.

Gesendet: 3. Juli 2018 7:28 vorm.
Betreff: Re: Pilog unification of a nested predicate

OK, I just got it XD

I had too many parentheses in the query.

The correct form is:
(? (vertical line (point 1 2) (point 1 3)))

But that leaves me with the question,
Why is the syntax "(vertical line (..." instead of "(vertical (line ..." ?

My best guess is that, internally, the symbol 'vertical gets consed into the rest of the predicate, 
as defined in its property list.

that is, when you run:
: (show 'vertical)
vertical NIL
   T (((line (point @X @Y) (point @X @Z))))
-> vertical

the name of the sym (vertical) gets consed into the (line (point @X @Y) (point @X @Z)) part,
and since that's what is used to unify the query, 
the query must have that same "(vertical line ..." structure.

But that's just a guess. If there is some deeper meaning I would be happy to know :D

On Mon, Jul 2, 2018 at 11:23 PM Bruno Franco <[email protected]> wrote:
The prolog saga continues!
This time, I'm having trouble with unification.

I have this predicate:
vertical(line(point(X, Y), point(X, Z))).

That gets unified with this query:
vertical(line(point(1, 2), point(1, 3))).

In prolog, this returns true.

But when I run what I (think) is the equivalent pilog code:

(be vertical (line (point @X @Y) (point @X @Z)))
(? (vertical (line (point 1 2) (point 1 3))))

The query returns NIL

Is my syntax wrong? Or should I have specified some other intermediate predicate?

Thank you

Reply via email to