Skip to content
Prev Previous commit
Next Next commit
Update euclidalg.ss
  • Loading branch information
c252 authored Feb 2, 2019
commit 0114f450009a6d9a5345e798772cd8700fc54745
6 changes: 3 additions & 3 deletions contents/euclidean_algorithm/code/scheme/euclidalg.ss
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
(cond
[(or (negative? a) (negative? b)) (euclid-sub (abs a) (abs b))]
[(eq? a b) a]
(if (> a b)
(euclid-sub (- a b) b)
(euclid-sub a (- b a)))))
[(> a b) (euclid-sub (- a b) b)]
(else
(euclid-sub a (- b a)))))

(define (euclid-mod a b)
(if (zero? b)
Expand Down