Permalink
Browse files

Simplified 20

  • Loading branch information...
1 parent 382a953 commit 1ff9368dc7a0f1e8dbe3842b548b8d14726c6a9d Eric Wilson committed Feb 9, 2011
Showing with 6 additions and 6 deletions.
  1. +2 −2 020.hs
  2. +4 −4 EulerMath/BigNum.hs
View
4 020.hs
@@ -1,4 +1,4 @@
import EulerMath.BigNum
-euler20 :: Int -> Int
-euler20 = sum . bigFact
+euler20 :: (Integral a) => (a -> a)
+euler20 = digitSum . fact
View
@@ -3,7 +3,7 @@ module EulerMath.BigNum
, bigSum
, times
, bigExp
-, bigFact
+, fact
, stringToBigNat
, bigNatToString
, intToBigNat
@@ -61,6 +61,6 @@ bigExp base n =
sqr :: BigNat -> BigNat
sqr big = times big big
-bigFact :: Int -> BigNat
-bigFact 0 = [1]
-bigFact n = times (intToBigNat n) (bigFact (n-1))
+fact :: (Integral a) => a -> a
+fact 0 = 1
+fact n = n * fact (n-1)

0 comments on commit 1ff9368

Please sign in to comment.