[Haskell-beginners] doing state right
flopticalogic at gmail.com
Fri Apr 24 15:07:28 EDT 2009
Bah! I completely forgot arrays were constant in lookup.
On Thu, Apr 23, 2009 at 3:05 AM, Chaddaï Fouché
<chaddai.fouche at gmail.com> wrote:
> 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
>> 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.
More information about the Beginners