Calling table/1 during runtime

I’m using: SWI-Prolog version 8.0.3 and have also tried running the code in SWISH.

I want the code to: I want to call table/1 during runtime. The tabling documentation says this is possible.

But what I’m getting is: From version 8.0.3, the error I’m getting is

ERROR: Wrong context: (table)/1 can only be used in a directive

I’m assuming from this that in 8.0.3 table/1 can only be used as a directive.

In SWISH,

No permission to call sandboxed `assert(_1336)'
Reachable from:
** assert_and_table(A)**

My code looks like this:

assert_and_table(P) :-
    assert(P),
    table(P).

I’m not very familiar with SWISH, and I just tried running the code to a SWISH notebook to see if calling table/1 during runtime was only possible in later versions. From the error it seems the problem is just that I don’t know how to use SWISH. Any suggestions appreciated.

This might be a little confusing :slight_smile:

  • The online manual runs the development version (8.1.x)
  • Runtime table/1 is only available in the development version
  • SWISH does not allow things that might compromise other users or the system. A call assert(P) can do anything as it doesn’t know what P is.That is why you get a permission error.

All current development is on tabling and thus if you want to explore tabling, please use the development versions. The non-tabling part is better and more stable than 8.0.3. Tabling is much better, but as it is under very active development it can be a unstable.

Thanks, Jan. I had a feeling it was related to the development version. I’ll look into that.