[Haskell-beginners] Mutable grid

Michael Orlitzky michael at orlitzky.com
Mon Dec 19 15:27:56 UTC 2016


On 12/19/2016 08:10 AM, mike h wrote:
> Hi,
> 
> I’m looking a problem where I have an NxN grid of ints. I need a
> function like setValue x y newVal
> 
> I have tried using [[Int]] but it does become messy when splitting ,
> dropping and then ++ back together.
> 
> What other options are available to represent a mutable grid?
> 

Mutable vectors (from the vector[1] package) are an obvious choice. When
I had to do something similar, I wound up going all the way to repa[2],
which magically turns all of your grid operations into parallel ones.


[1] https://hackage.haskell.org/package/vector
[2] https://hackage.haskell.org/package/repa



More information about the Beginners mailing list