[Haskell-beginners] Another currying and lambda question
Lawrence Bottorff
borgauf at gmail.com
Tue Dec 22 21:15:42 UTC 2020
Thanks again!
On Tue, Dec 22, 2020 at 11:59 AM Francesco Ariis <fa-ml at ariis.it> wrote:
> Il 22 dicembre 2020 alle 11:48 Lawrence Bottorff ha scritto:
> > flipA :: (a -> b -> c) -> b -> a -> c
> > flipA f x y = f y x
> >
> > What is it specifically about currying that makes flipA possible?
>
> I do not see how currying is involved here! Maybe when you pass
> a function to an higher order one?
>
> > flipB :: (a -> b -> c) -> b -> a -> c
> > flipB f = \x y -> f y x
> >
> > Also, with flipB, could someone explain the beta reduction? It looks
> > like f is not being acted on, just passed along, Would it look more
> > like this in lambda calculus?
>
> Indeed `f` is not being acted on (i.e. it is «outside» of the lambda)
>
> (λx. λy. f y x) b a
> (λy. f y b) a beta
> f a b beta
>
> fully expressed with lambdas would be:
>
> (λf. λx. λy. f y x) g b a
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20201222/e0b5c0f2/attachment-0001.html>
More information about the Beginners
mailing list