There was an error while loading. Please reload this page.
1 parent 06a8159 commit ee361abCopy full SHA for ee361ab
chapter06-Recursive-functions/4.hs
@@ -0,0 +1,7 @@
1
+euclid :: Int -> Int -> Int
2
+euclid 0 n = n
3
+euclid n 0 = n
4
+euclid m n | m < n = euclid m (n - m)
5
+ | otherwise = euclid (m - n) n
6
+
7
+{- The algorithm is slightly modified to process corner cases. -}
0 commit comments