Anonymous user
Greatest common divisor: Difference between revisions
→{{header|Racket}}
Line 1,898:
Racket provides a built-in gcd function. Here's a program that computes the gcd of 14 and 63:
<lang
(gcd 14 63)</lang>
Line 1,904:
Here's an explicit implementation. Note that since Racket is tail-calling, the memory behavior of this program is "loop-like", in the sense that this program will consume no more memory than a loop-based implementation.
<lang
;; given two nonnegative integers, produces their greatest
|