Author: | Loryn |
---|---|
Mode: | factor |
Date: | Wed, 8 Apr 2009 10:51:27 |
In learning Factor, I implemented the following pseudocode in Factor. Psuedocode function gcd(a, b) while b ≠ 0 t := b b := a mod b a := t return a Factor : gcd-by-division ( x y -- z ) [ dup zero? ] [ tuck mod ] until drop ;