Re: singleton variable in branch ?

Jochem Liem <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CABryw9SPDLD_AK2p4N5E4DHqp2HoYyY9b_K7TkG3M3wy9LyS+A@mail.gmail.com>
The singleton is in the second branch (subsynset). Adding a '_' makes
the warning go away.

subsynset(Sub, Super) :-
   s(I,_,Sub,Kind,_,_),
   (
      hyp(I, J) ->
      s(J,_,Hyp,Kind,_,_),
      Hyp = Super
   ;
      subsynset(_Hyp, Super)
   ).

- Jochem

On Sat, Mar 1, 2014 at 9:37 AM, Carlo Capelli <[email protected]> wrote:
> I get a warning in very simple code - Singleton variable in branch: Hyp
>
> and I can't spot from where the problem arise.
>
>
> subsynset(Sub, Super) :-
>
>  s(I,_,Sub,Kind,_,_),
>
>    ( hyp(I, J) -> s(J,_,Hyp,Kind,_,_), Hyp = Super
>
>   ; subsynset(Hyp, Super)  ).
>
>
>
> I tried to swap the Hyp binding - just to see if the warning goes away -
> without luck
>
>
> ...
>
> -> s(J,_,Hyp,Kind,_,_), Hyp = Super
>
> ...
>
>
> Seems that Hyp is present on both branches. Maybe I'm missing some
> execution path ? Any hint about ?
>
>
> Thanks Carlo
> -------------- next part --------------
> HTML attachment scrubbed and removed
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog



-- 
Jochem Liem, PhD
http://jochemliem.wordpress.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.