Question

What does ?- mean in Prolog?

for example:

?- consult(solve)
Was it helpful?

Solution

?- is typically the prompt of the top level loop or top level shell — which is the place where you can ask queries and enter commands. It has similar functionality as the read-eval-print loop in other languages.

In some systems this prompt is or used to be | ?- which is the more traditional prompt. This prompt comes from one of the earlier Prolog systems of ~1978, DECsystem 10 Prolog. The OS prompt for input was | and the user had to type ?- X is 1+1. to enter a query.

OTHER TIPS

Within a prolog interpreter you can request data (that's basically running prolog scripts), the system replies with a yes or no. The interpreter signals with ?-, that he awaits a request.

Example:

?- male(adam).
yes.
?- male(eve).
no.

Read more in the wikipedia article for it

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top