I want to propose the following function slide, which is like map, but
depends not on one value of
a list, but on several consecutive ones.

slide :: ([a] -> b) -> [a] -> [b]
slide f [] = []
slide f xs = f xs : slide f (tail xs)

For example, this is useful for a digital filter, like

lowpass = firfilter [0.005178,0.005712,0.00589,0.005712,0.005178]

firfilter :: [Coeff] -> DigitalFilter
firfilter b = slide (firfilter' b)
  where
     firfilter' b = sum . zipWith (*) b


What do you think? Or is there already a function slide, just with another
name?

Markus



--
Markus Schnell, Infineon Technologies AG 

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to