On 02/23/2015 10:11 PM, Sumit Sahrawat, Maths & Computing, IIT (BHU) wrote:
> Hi everyone,
>
> I defined a function for discrete convolution, i.e
>
> conv xs = sum . zipWith (*) xs . reverse
>
> And I was wondering, can it be done without explicitly passing in the xs
> (eta-reduction)?
Ehhhhhhhhhh this will work:
conv = (sum .) . (. reverse) . zipWith (*)
But it's so much easier to understand without all the boobies operators:
conv xs ys = sum $ zipWith (*) xs (reverse ys)
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe