Re: Problem with SWI-Prolog



SRocha schreef in comp.lang.prolog:

> Hi,
>
> I have a doubt in SWI-Prolog. L and C are line and column respectively.
> I want that swi-prolog consider the numeric value of C-1. Is there any
> function to do this.
> the result of the query must be yes.
>
> q(9,8).
> p(L,C) :- q(L,C-1).
>
> ?-p(9,9)
> No

Try this:

q(9,8).
p(L,C):-
D is C - 1,
q(L,D).


?- p(9,9).

Yes

greetz
Wouter
--
http://www.ligezin.be/
.



Relevant Pages

  • Synchronized Predicate Call
    ... i need to implement a mechanism of Synchronized Predicate ... anyone will give me a suggestion? ... I use swi-prolog. ... Prev by Date: ...
    (comp.lang.prolog)
  • Lists in Learn Prolog Now
    ... I cannot reproduce the result asserted in section 4.3 of Learn Prolog ... SWI-Prolog. ... Prev by Date: ...
    (comp.lang.prolog)
  • Lists in Learn Prolog Now
    ... I cannot reproduce the result asserted in section 4.3 of Learn Prolog ... SWI-Prolog. ... Prev by Date: ...
    (comp.lang.prolog)
  • Re: Problem with SWI-Prolog
    ... > I want that swi-prolog consider the numeric value of C-1. ... is a good idea to understand why it was failing. ... Geoff ... Prev by Date: ...
    (comp.lang.prolog)