[Haskell-beginners] doing state right

Chaddaï Fouché chaddai.fouche at gmail.com
Thu Apr 23 04:05:41 EDT 2009


On Thu, Apr 23, 2009 at 10:03 AM, Chaddaï Fouché
<chaddai.fouche at gmail.com> wrote:
>
> main = quick_ppm "foo.ppm" (\i j -> isPrime ((i-1)*limit+j)) limit limit
>  where
>    isPrime n = primeSieve ! n
>    primeSieve :: UArray Int Bool
>    primeSieve = accumArray (\_ _ -> True) False (0,limit*limit) $ zip
> primes (repeat ())
>

That should read as "zip (takeWhile (<= limit*limit) primes) (repeat
())" of course.

-- 
Jedaï


More information about the Beginners mailing list