• Final Project

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


primes = filterPrime [2..]
  where filterPrime (p:xs) =
          p : filterPrime [x | x <- xs, x mod `mod` p /= 0]

Of course, Haskell has built-in support for lazy streams and the recursive definition of functions (like filterprime) using pattern matching all supported by an aggressive optimizing compiler.  Your task is to extend the provided code to support a static final field called primes in the top-level interface IntStream bound to the lazy infinite stream of primes (ignoring the fact that int arithmetic will overflow when numbers get too large.  You also need to augment the JUnit test file (compatible with JUnit 4 as provided by DrJava) IntStreamTest.java to further test your code.  You may assume that all of the provided code is correct. [Please tell us if you discover any bugs!]  You do not need to test any of the methods in the IntStream interface provided by the original version of primeSieve.java.