Did you know ... | Search Documentation: |
![]() | Tabling and constraints |
Starting with version 9.3.24, SWI-Prolog offers some support for tabled execution with constraints (attributed variables, see section 8.1) All relevant data structures support attributed variables, notably tries (see section 4.14.4). The basic attributed variable and tabling with attributed variables tests from XSB have been ported and integrated in SWI-Prolog's test suite.193Thanks to Theresa Swift and David Warren. Some remarks:
:- use_module(library(clpfd)). :- table p/1. p(X) :- X #>= 1, X #=< 6. p(20).
?- X #> 0, p(X). X in 1..6 ; X = 20.
Note that this behaviour is unlike trie_gen/2. If an attributed variable is inserted into a trie, trie_gen/2 unifies the stored attributed term with the second argument of the call.