[Haskell-beginners] Lambda expression currying

Lawrence Bottorff borgauf at gmail.com
Tue Dec 22 16:00:22 UTC 2020


Thanks, that's clearer now.

On Tue, Dec 22, 2020 at 12:55 AM Francesco Ariis <fa-ml at ariis.it> wrote:

> Hello Lawrence,
>
> Il 21 dicembre 2020 alle 23:59 Lawrence Bottorff ha scritto:
> > addThree :: (Num a) => a -> a -> a -> a
> > addThree = \x -> \y -> \z -> x + y + z
> > […]
> >
> > But how is the beta reduction happening with addThree?
>
> Should be:
>
> addThree = (\x -> \y -> \z -> x + y + z) 1 2 3
>          = (\y -> \z -> 1 + y + z) 2 3              beta
>          = (\z -> 1 + 2 + z) 3                      beta
>          = 1 + 2 + 3                                beta
>          = …
>
> Does that make sense?
> —F
> _______________________________________________
> 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/771a0001/attachment.html>


More information about the Beginners mailing list