[Haskell-cafe] How to devide matrix into small blocks
voigt at tcs.inf.tu-dresden.de
Wed Jun 13 03:17:54 EDT 2007
Henning Thielemann wrote:
> On Wed, 13 Jun 2007, L.Guo wrote:
>>I already have one matrix of type [[a]] to store one image.
>>What I want to do is to devide the image into severial small blocks in same size.
>>To do that, I wrote this tool function.
>>chop :: Int -> [a] -> [[a]]
>>chop _  = 
>>chop n ls = take n ls : chop n (drop n ls)
> I assume that it is more efficient to use 'splitAt' instead of 'take' and
>>But I do not know how to use it to write the function.
> chop blockHeight (map (chop blockWidth) image)
That would divide
at block size 2. In any case, the original poster was not very clear
about what they want...
Dr. Janis Voigtlaender
mailto:voigt at tcs.inf.tu-dresden.de
More information about the Haskell-Cafe