I’m playing around with constraints but am stuck on how to iterate through the attributes assigned to a variable. The second argument of get_attrs/2 won’t unify with a term of the form att(A, B, C)
:
:- module(noun, [noun/2]).
noun(TypeName, X) :-
var(X),
!,
put_attr(X, noun, TypeName).
resolveConstraints(Variable, Value) :-
% Docs say that second argument returns something in the form:
% att(module, value, More)
get_attrs(Variable, Attrs),
writeln(Attrs),
% This fails...
Attrs = att(Module, Value, []).
?- noun("rock", X), resolveConstraints(X, a).
att(noun,rock,[])
false.
What am I missing?