как я понял, что такое аппликатив
May. 18th, 2012 05:49 pmzap = zipWith ($)
vec f a b = zap (zap (repeat f) a) b
mx f = vec $ vec f
processMatrix mat = ...
where
mats = mat:vec (mx (+)) mats (init $ tails $ tail mat) -- find all matrices consisting of sums of consecutive rows of mat
maxes = concat $ mx doCols [[(r0,r0+h) | r0 <- [0..]] | h <- [0..]] mats -- apply doCols to individual rows of the list of matrices
...