Skip to content

Commit

Permalink
W1: more robust definition of primes in tests
Browse files Browse the repository at this point in the history
nubBy changed subtly for ghc 7.10

closes #15 closes #16
  • Loading branch information
opqdonut committed May 25, 2015
1 parent 844a4db commit bc32d75
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion W1Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ ex16_pyramid =
f (pyramid n) === ([0..n] ++ [n-1,n-2..0])
where f xs = map read $ split ',' xs

primes = nubBy (\x y -> mod x y == 0) [2..]
primes = go [2..]
where go (x:xs) = x : go (filter (notDivBy x) xs)
notDivBy x y = mod y x /= 0

ex17_smallestDivisor_prime = do
forAll (elements $ take 12 primes) $ \p ->
Expand Down

0 comments on commit bc32d75

Please sign in to comment.