[Haskell-cafe] Composition and type magic

Sumit Sahrawat, Maths & Computing, IIT (BHU) sumit.sahrawat.apm13 at iitbhu.ac.in
Tue Feb 24 05:57:40 UTC 2015


Thanks.
You've given me a good exercise in equational reasoning.

I'm studying such things because I might start studying combinatory logic
(Smullyan's mockingbird book) soon.
It's a good exercise for the mind, and is very enjoyable with pencil &
paper.
Can you give me some more patterns like transducers (foldl foldl) and the
dot-dot-dot ( boobies, in your words :) ) example?

Thanks once again.

On 24 February 2015 at 08:57, Michael Orlitzky <michael at orlitzky.com> wrote:

> 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 at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>



-- 
Regards

Sumit Sahrawat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150224/c2b5c6c2/attachment.html>


More information about the Haskell-Cafe mailing list