Prolog and Logical definitions of plus/subtract
- From: "John Todd" <mctodd333@xxxxxxxxxxx>
- Date: 26 Oct 2006 15:32:23 -0700
Hello,
I know that the logical definition of and plus and subtract in Prolog
is:
plus(0,N,N).
plus(s(M),N,s(Z)) :- plus(M,N,Z).
where s(X) is the successor of number X.
However, what would you do if you wanted to represent negative numbers?
Thanks,
John
.
- Follow-Ups:
- Re: Prolog and Logical definitions of plus/subtract
- From: Jussi Piitulainen
- Re: Prolog and Logical definitions of plus/subtract
- Prev by Date: Re: please ignore
- Next by Date: Re: Prolog and Logical definitions of plus/subtract
- Previous by thread: please ignore
- Next by thread: Re: Prolog and Logical definitions of plus/subtract
- Index(es):
Relevant Pages
|
|