On Sat, Feb 21, 2015 at 4:50 PM, Joel Neely <joel.neely@gmail.com> wrote:smooth :: Fractional n => [n] -> [n]smooth (a:z@(b:c:_)) = (a + b + c) / 3 : smooth zsmooth _ = []In Haskell, I would write this with higher-order functions though :smooth xs = zipWith3 (\a b c -> (a+b+c)/3) xs (drop 1 xs) (drop 2 xs)
--Jedaï
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners