Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Confusion over currying, , lambda,   and closures (Joel Neely)


----------------------------------------------------------------------

Message: 1
Date: Thu, 24 Dec 2020 06:12:08 -0600
From: Joel Neely <joel.ne...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Confusion over currying, , lambda,
        and closures
Message-ID:
        <CAEEzXAgS-28N=xwnioy9v7_9edbk4iebzssl8cy1jbo+ohb...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi, Lawrence,

Would it help you to think of addB as a function that takes its argument x
and returns a function/lambda that adds x to the argument to which that
returned function is applied?

Best wishes,
-jn-

On Wed, Dec 23, 2020 at 9:12 PM Lawrence Bottorff <borg...@gmail.com> wrote:

> I have these three versions of addition
>
> addA x y = x + y
> addB x = \y -> x + y
> addC = \x -> \y -> x + y
>
> and all three add two arguments just fine
>
> > addA 2 3
> 5
> > addB 2 3
> 5
> > addC 2 3
> 5
>
> but I can't see how addB and addC are actually accomplishing this. addA is
> currying, which I don't fully follow. addC I understand beta reduction-wise
>
> (\x -> \y -> x + y) 2 3
> (\y -> 2 + y) 3
> (2 + 3)
> 5
>
> but I don't understand addB and what steps are happening currying/beta
> reduction-wise. Can someone break down the steps with addA and addB?
>
> LB
>
>
> _______________________________________________
> Beginners mailing list
> Beginners@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/20201224/a844acc1/attachment-0001.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 149, Issue 19
******************************************

Reply via email to