Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:prolog:pllib:ackermann [2019/06/27 15:50]
pl:prolog:pllib:ackermann [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Ackermann ======
 +{{tag>​function}}
 +===== Description =====
 +Program calculate Ackermann'​s function
 +
 +**Source**: ​ The Art of Prolog
 +===== Download =====
 +Program source code: {{prolog:​pllib:​ackermann.pl}}
 +===== Listing =====
 +<code prolog>
 +/*
 + ackermann(X,​Y,​A) :-
 + A is the value of Ackermann'​s function for
 + the natural numbers X and Y.
 +*/
 +
 + ackermann(0,​N,​s(N)).
 + ackermann(s(M),​0,​Val) :- ackermann(M,​s(0),​Val).
 + ackermann(s(M),​s(N),​Val) :-
 + ackermann(s(M),​N,​Val1),​ ackermann(M,​Val1,​Val).
 +
 +% Program 3.9: Ackermann'​s function
 +
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/ackermann.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0