[Haskell-beginners] Confusion over currying, , lambda, and closures
Lawrence Bottorff
borgauf at gmail.com
Thu Dec 24 03:12:08 UTC 2020
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20201223/c75630f1/attachment.html>
More information about the Beginners
mailing list