Numeric matrix tiles in Haskell -


having numeric matrix, how can tiles extracted using haskell?


example:

int -> int -> int -> int -> [int] -> int -> int -> [int] gettile height width x y xs matrix_height matrix_width = ... gettile 2 2 1 1 [1,2,3,4,5,                  6,7,8,9,10] 2 5 = [2,3                                     7,8] 

you might instead want use numeric.matrix bed-and-breakfast package. it's lot more efficient , has way of constructing submatrix (fixed, select inappropriate).

gettile height width x y m = matrix getelem (height,width)     getelem (i,j) = m `at` (i+x-1, j+y-1) 

numeric.matrix uses 1-based indexing, might complicate matters little.


Comments