Type conversion

I’m using: SWI-Prolog version 8.0.2

I want the code to: convert the type of position from Node?position to position as a a pair of integers (X,Y)

But what I’m getting is: @2349857/position

My code looks like this:
show_position(Node) :->
“show position of a node”::
point(X,Y)=Node?position, %this type conversion does not work

This does nothing more or less that Prolog unification. Prolog knows nothing about xpce and just sees two different terms and thus fails. Ty this:

    get(Node, position, point(X,Y))

P.s. Please enclose code blocks in ``` ... ```, so we can read it :slight_smile:

1 Like