
14 Jun
2007
14 Jun
'07
7:26 p.m.
What about blocks w h = concatMap transpose . map (map (chop w)) . chop h ? @L. Guo: map concat . blocks w h is what you want. Cheers, Daniel Am Donnerstag, 14. Juni 2007 09:42 schrieb Janis Voigtlaender:
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 ]
for (w,h)=(2,2), into:
[ a e , b f , c g , d h , i m , j n , k o , l p ]
for (w,h)=(1,2), and so on.
(Where an image like
ab ef
is represented as ["ab","ef"].)
Have fun, Janis.