The root problem is that random number generation is inherently
stateful, and so the familiar imperative idioms don't translate
directly into a pure functional language. In a C-like language, each
invocation of rand() mutates a secret piece of state lurking
off-stage; pure functional code doesn't
I'm trying to experiment with image processing in haskell (with which
I haven't much experience). I've written some FFI code to talk to
the ImageMagick library which provokes a few questions (environment is
ghc 6.2.1 on debian):
1. Speed: I'm reading in a 2000x1500 pixel image, and have defined
Alastair Reid writes:
[...]
Overall, I'd probably use an unboxed Haskell array. This would let you get a
memory layout (and memory consumption) close to the normal C layout. I'd use
access functions to hide the boxing/unboxing and I'd write some
map/fold/scan-like functions to