diff options
author | Joe Zhao <ztuowen@gmail.com> | 2014-08-07 16:38:13 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2014-08-07 16:38:13 +0800 |
commit | bc88e3464180e781e7ad2d552de0c8e496448d2e (patch) | |
tree | 56697567ecb8c49504014d58e2698870ad37514a | |
download | haskbox-old-bc88e3464180e781e7ad2d552de0c8e496448d2e.tar.gz haskbox-old-bc88e3464180e781e7ad2d552de0c8e496448d2e.tar.bz2 haskbox-old-bc88e3464180e781e7ad2d552de0c8e496448d2e.zip |
Initial commit
Changes to be committed:
new file: gcd.hs
-rw-r--r-- | gcd.hs | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -0,0 +1,11 @@ +import Control.Monad.Writer + +gcd' :: Int -> Int -> Writer [String] Int +gcd' a b + | b == 0 = do + tell ["Finished with " ++ show a] + return a + | otherwise = do + tell [show a ++ " mod " ++ show b ++ " = " ++ show (a `mod` b)] + gcd' b (a `mod` b) + |