Parker Jones
2014-03-17 12:32:01 UTC
This code gives the warning "Singleton variable in branch: A", but shouldn't it be a regular singleton warning?
p(X) :-
(X > 0 ->
A=1
;
A=0
).
I spent time trying to figure out
which branch was to blame (in more complex code), when in fact the branches are fine, it's just
that the variable isn't used afterwards.
p(X) :-
(X > 0 ->
A=1
;
A=0
),
write(A). % use variable A and the warning goes away.
Cheers,
Parker
-------------- next part --------------
HTML attachment scrubbed and removed
p(X) :-
(X > 0 ->
A=1
;
A=0
).
I spent time trying to figure out
which branch was to blame (in more complex code), when in fact the branches are fine, it's just
that the variable isn't used afterwards.
p(X) :-
(X > 0 ->
A=1
;
A=0
),
write(A). % use variable A and the warning goes away.
Cheers,
Parker
-------------- next part --------------
HTML attachment scrubbed and removed