SHARE
TWEET

prolog2

a guest Feb 27th, 2020 100 in 138 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. isnumber(zero).
  2. isnumber(s(X)) :- isnumber(X).
  3.  
  4. isequal(X,X) :- isnumber(X).
  5. isequal(s(X),s(Y)) :- isequal(X,Y).
  6.  
  7. lessthanequal(zero,X) :- isnumber(X).
  8. lessthanequal(s(X), s(Y)) :- lessthanequal(X,Y).
  9.  
  10. add(zero,X,X) :- isnumber(X).
  11. add(s(X), Y, s(Z)) :- add(X,Y,Z).
  12.  
  13. %even(zero).
  14. %even(s(X)) :- zero is mod(X,).
  15.  
  16. plus(zero,X,X) :- isnumber(X).
  17. plus(s(X),Y,s(Z)) :- plus(X,Y,Z).
  18.  
  19. times(zero,X,zero) :- isnumber(X).
  20. times(s(X),Y,Z) :- times(X,Y,Q), plus(Y,Q,Z).
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top