I have the following file:
:- use_module(library(clpfd)).
isPowTwo(N) :- N #> 0, N #= 2^_.
Everything works fine:
?- [importTest].
% library(pairs) compiled into pairs 0.00 sec, 22 clauses
% library(lists) compiled into lists 0.01 sec, 122 clauses
% library(occurs) compiled into occurs 0.00 sec, 14 clauses
% library(apply_macros) compiled into apply_macros 0.01 sec, 168 clauses
% library(assoc) compiled into assoc 0.01 sec, 103 clauses
% library(clpfd) compiled into clpfd 0.15 sec, 2,808 clauses
% importTest compiled 0.16 sec, 2,813 clauses
true.
Now I want to import just the two used operators:
:- use_module(library(clpfd), [(#>)/2, (#=)/2]).
isPowTwo(N) :- N #> 0, N #= 2^_.
And it does not work:
?- [importTest].
% library(pairs) compiled into pairs 0.00 sec, 22 clauses
% library(lists) compiled into lists 0.01 sec, 122 clauses
% library(occurs) compiled into occurs 0.00 sec, 14 clauses
% library(apply_macros) compiled into apply_macros 0.01 sec, 168 clauses
% library(assoc) compiled into assoc 0.01 sec, 103 clauses
% library(clpfd) compiled into clpfd 0.16 sec, 2,808 clauses
ERROR: .../importTest.pl:3:17: Syntax error: Operator expected
% importTest compiled 0.16 sec, 2,812 clauses
true.
?- isPowTwo(1).
ERROR: toplevel: Undefined procedure: isPowTwo/1 (DWIM could not correct goal)
Leaving the parentheses around #>
and #=
makes no difference.