5
votes

I get this compound term:

e(currentNode,"http://localhost:9000/")

How can I get only http://localhost:9000/ separately from that compound? Or less, is there a way to transform the compound term to a string or a list?

1
It worked, I tried with: comp(e(_,X)):- write(X). Thank you CapelliC :) - hiba hawes

1 Answers

2
votes

In general you use unification for that:

e(currentNode,"http://localhost:9000/") = e(_,X).

will bind "http://localhost:9000/" to X.

You use unification also when you this implicitly by putting variables in place of terms in your query, e.g.:

?- comp(e(_,X)).

will bind to X the second argument of e for every matching result.