Download SICStus Prolog User`s Manual
Transcript
Chapter 15: Attributed Variables ; put_atts(Fresh, dom(Set)), X = Fresh 259 % may call % verify_attributes/3 ). Note that the “implied binding” Other=El was deferred until after the completion of verify_attribute/3. Otherwise, there might be a danger of recursively invoke verify_ attribute/3, which might bind Var, which is not allowed inside the scope of verify_ attribute/3. Deferring unifications into the third argument of verify_attribute/3 effectively serializes th calls to verify_attribute/3. Assuming that the code resides in the file ‘domain.pl’, we can use it via: | ?- use_module(domain). Let’s test it: | ?- domain(X,[5,6,7,1]), domain(Y,[3,4,5,6]), domain(Z,[1,6,7,8]). domain(X,[1,5,6,7]), domain(Y,[3,4,5,6]), domain(Z,[1,6,7,8]) ? yes | ?- domain(X,[5,6,7,1]), domain(Y,[3,4,5,6]), domain(Z,[1,6,7,8]), X=Y. Y = X, domain(X,[5,6]), domain(Z,[1,6,7,8]) ? yes | ?- domain(X,[5,6,7,1]), domain(Y,[3,4,5,6]), domain(Z,[1,6,7,8]), X=Y, Y=Z. X = 6, Y = 6, Z = 6 To demonstrate the use of the Goals argument of verify_attributes/3, we give an implementation of freeze/2. We have to name it myfreeze/2 in order to avoid a name clash with the built-in predicate of the same name. :- module(myfreeze, [myfreeze/2]). :- use_module(library(atts)). :- attribute frozen/1. verify_attributes(Var, Other, Goals) :-
Related documents
SICStus Prolog User`s Manual
SICStus Prolog User`s Manual
SICStus Prolog User`s Manual
SICStus Prolog User's Manual
3 - Oracle Documentation
User manual
Sec - SICStus Prolog 3
section “Command line editing” in the SICStus Prolog Release Notes
Datalog Educational System Release Notes History
Sec - Institut für Informatik
T OY - GPD - Universidad Complutense de Madrid
Wheeled Stair Climber N 911 - 912 - 913 YACK instruction