[Haskell-cafe] How to devide matrix into small blocks

Janis Voigtlaender voigt at tcs.inf.tu-dresden.de
Thu Jun 14 08:24:23 EDT 2007


Henning Thielemann wrote:
> On Thu, 14 Jun 2007, Janis Voigtlaender wrote:
> 
> 
>>Anyway, as a challenge to others on the list: write a one-liner that
>>splits an "image" like ["abcd","efgh","ijkl","mnop"], interpreted as
>>
>>abcd
>>efgh
>>ijkl
>>mnop
>>
>>into the list of images:
>>
>>[
>>ab
>>ef
>>,
>>cd
>>gh
>>,
>>ij
>>mn
>>,
>>kl
>>op
>>]
> 
> 
> It's just an additional 'concat' in my solution, isn't it? Ah, you mean
> without the 'split' helper function?

No, I do mean using the chop function provided by the original poster. 
And I think that adding a concat to your solution, as in:

concat (chop blockHeight (map (chop blockWidth) image))

gives the following, different from above:

[
ab
cd
,
ef
gh
,
ij
kl
,
mn
op
]

Ciao, Janis.

-- 
Dr. Janis Voigtlaender
http://wwwtcs.inf.tu-dresden.de/~voigt/
mailto:voigt at tcs.inf.tu-dresden.de


More information about the Haskell-Cafe mailing list