Search code examples
prologiso-prologprolog-assertjekejeke

Unable to create Fact in Jekejeke Prolog


I'm using the Seven Languages In Seven Weeks Prolog tutorial and trying to run through some examples using the Android Jekejeke Runtime. For example, if I add

likes(wallace, grommit).

from the tutorial, I get.

Error: Undefined, private or package local predicate likes/2

I tried using assert, as described in How to create a fact in SWI-Prolog?, but then it says that assert is undefined, instead of likes.

Presumably I'm missing something basic about how the runtime works, or its dialect of prolog.it.


Solution

  • assert/1 is not a standard predicate, although several implementations provide it. That doesn't seem to be the case for Jekejeke Prolog. Use instead either the asserta/1 or the assertz/1 standard predicates. The first asserts a clause as the first for the predicate. The latter asserts a clause as the last for the predicate.