InDaPond
InDaPond

Reputation: 572

Swi Prolog Editor only shows false, not true

Assume my knowledge base contains one fact: fact(fact1).

If I know submit a query fact(fact1).

39 ?- fact(fact1).

40 ?- 

it says nothing, which is the equivalent to true. B/c if it's wrong, Prolog responds with false:

38 ?- fact(foobar).
false.

So how can I change it so I get a true. ?

Upvotes: 0

Views: 648

Answers (1)

Janne Jämsen
Janne Jämsen

Reputation: 11

Looks like SWI Prolog Editor (at least on some versions), by default, sets the following environmental flag:

set_prolog_flag(prompt_alternatives_on, groundness).

To display true you can change it like this:

set_prolog_flag(prompt_alternatives_on, determinism).

This has the side effect of requiring the user to press after each true to return to the interactive prompt though... (Not sure if there is some better way to achieve this.)

Upvotes: 1

Related Questions