Permalink
Browse files

tiny refactor to solution for 57

  • Loading branch information...
1 parent ebcda72 commit 684de1b249b5b354b9be1df78a822fe406a0e98b Evan Klitzke committed Apr 30, 2008
Showing with 6 additions and 6 deletions.
  1. +6 −6 57/EulerProblem.hs
View
@@ -8,13 +8,13 @@ fracRecip (Frac n d) = Frac d n
fracInc :: Fraction -> Fraction
fracInc (Frac n d) = Frac (n + d) d
-magic :: Fraction -> Bool
-magic (Frac n d) = (length $ show n) > (length $ show d)
-
nextFrac :: Fraction -> Fraction
-nextFrac f = fracInc (fracRecip (fracInc f))
+nextFrac = fracInc . fracRecip . fracInc
fracs :: [Fraction]
-fracs = take 1000 ((Frac 3 2) : [nextFrac f | f <- fracs])
+fracs = ((Frac 3 2) : [nextFrac f | f <- fracs])
+
+magic :: Fraction -> Bool
+magic (Frac n d) = (length $ show n) > (length $ show d)
-main = print $ length $ filter magic fracs
+main = print $ length $ filter magic $ take 1000 fracs

0 comments on commit 684de1b

Please sign in to comment.