[Haskell-cafe] (no subject)

u4538637 at anu.edu.au u4538637 at anu.edu.au
Thu May 8 09:36:02 EDT 2008

Hi I have a bit of a dilemma.I have a list of lists, eg, [[1,2,3],[4,5,6],[7,8,9]]. Imagine they represent a grid with 0-2 on the x axis and 0-2 on the y axis, eg, (0,0) is 1, (1,0) is 2, (2,1) is 6, etc and (2,3) is 9. I want to be able to put in the list of lists, and the (x,y) coordinate, and return the value. 

Also, I need to be able to replace a value in the list. Eg, if I wanted to replace (2,3) with 100, then the output of the expression would be [[1,2,3],[4,5,6],[7,8,100]].

Any help would be great!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080508/0a56c717/attachment.htm

More information about the Haskell-Cafe mailing list