Greatest common divisor: Difference between revisions

Line 402:
 
<lang lisp>(defn gcd
"(gcd a b) computes the greatest common divisor of a and b."
[a b]
(if (zero? b)
a
(recur b (mod a b)))) ; This is (gcd b (mod a b)), but with explicit tail call optimization.</lang>
 
That <code>recur</code> call is the same as <code>(gcd b (mod a b))</code>, but makes use of Clojure's explicit tail call optimization.
 
=={{header|COBOL}}==
Anonymous user