Guest User

Untitled

a guest
Jul 15th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. :-arithmetic_function(!/1).
  2. :-arithmetic_function(!/2).
  3. :-arithmetic_function('!!'/1).
  4. :-arithmetic_function('!!'/2).
  5.  
  6.  
  7. :-op(300,xf,!).
  8. :-op(300,xf,'!!').
  9.  
  10. !(0,1) :- !.
  11. !(1,1) :- !.
  12. !(N,W):-
  13. N > 0,
  14. N1 is N-1,
  15. !(N1,W1),
  16. W is N*W1.
  17.  
  18. '!!'(1,1) :- !.
  19. '!!'(N,W):-
  20. N > 0,
  21. N1 is N-2,
  22. '!!'(N1,W1),
  23. W is N*W1.
Add Comment
Please, Sign In to add comment