Versions Compared

Key

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

...

If I make any enhancements to the support code file primeSieve.java, I will post messages to that effect to Piazza.

 

Complications

Java is strictly a call-by-value language and lacks macros, so we are going to have to wrap the stream argument in a "cons" construction in a suspension (an object with a method to evaluate it and a cell to store that value).  This will make translating the simple Haskell code above more cumbersome.  There is a price to writing functional code in Java, a language not intended to support lazy evaluation.  In Racket/Scheme, we would make the stream cons operation a macro that automatically performs the wrapping.