# Table/1 outside directive

**URL:** <https://swi-prolog.discourse.group/t/table-1-outside-directive/741>\
**Category:** Help!\
**Created:** [May 29, 2019, 9:30pm UTC](https://swi-prolog.discourse.group/t/table-1-outside-directive/741 "2019-05-29T21:30:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![swi](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@swi](https://swi-prolog.discourse.group/u/swi)\
**Post date:** [May 29, 2019, 9:30pm UTC](https://swi-prolog.discourse.group/t/table-1-outside-directive/741/1 "2019-05-29T21:30:13Z")

</div>

Can `table/1` be used outside of a directive?  
e.g.

```prolog
enable_memoization :-
    table my_goal/1.

disable_memoization :-
    abolish_table_subgoals(my_goal(_)),
    % how would I disable table my_goal/1 here?

```

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [May 30, 2019, 10:18am UTC](https://swi-prolog.discourse.group/t/table-1-outside-directive/741/2 "2019-05-30T10:18:27Z")

</div>

At the moment not. The latest (git) version is a lot closer to realise this. I surely plan to provide that as it facilitates creating tabled programs fully dynamically without creating a file.

---

<div class="post-metadata">

**Author:** ![swi](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@swi](https://swi-prolog.discourse.group/u/swi)\
**Post date:** [May 30, 2019, 10:45am UTC](https://swi-prolog.discourse.group/t/table-1-outside-directive/741/3 "2019-05-30T10:45:32Z")

</div>

Great! This will be very useful!

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [June 4, 2019, 11:24am UTC](https://swi-prolog.discourse.group/t/table-1-outside-directive/741/4 "2019-06-04T11:24:25Z")

</div>

If you do not mind building from source, please give the current git version (V8.1.7-4-gb83c00d95 or later) a try. You can call table/1 as a predicate and call untable/1 to remove the tabling (as well as the associated tables).

---

<div class="post-metadata">

**Author:** ![swi](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@swi](https://swi-prolog.discourse.group/u/swi)\
**Post date:** [June 5, 2019, 1:49am UTC](https://swi-prolog.discourse.group/t/table-1-outside-directive/741/5 "2019-06-05T01:49:20Z")

</div>

Jan,

Thanks, this is great! It is working well from my quick testing!
