<div dir="auto">The steps and semantics are the same, the only meaningful difference is syntax.</div><div dir="auto"><br></div><div dir="auto">These two definitions are indistinguishable:</div><div dir="auto"><br></div><div dir="auto">f x = y</div><div dir="auto">f = \x -> y</div><div dir="auto"><br></div><div dir="auto">In basically the same way that these two expressions are:</div><div dir="auto"><br></div><div dir="auto">(+) 1 2</div><div dir="auto">1 + 2</div><div dir="auto"><br></div><div dir="auto">In Haskell there are many cases where a more convenient but equivalent syntax exists to express certain terms. This is referred to as syntax sugar.</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 23, 2020 at 19:12 Lawrence Bottorff <<a href="mailto:borgauf@gmail.com">borgauf@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I have these three versions of addition<div><br></div><div>addA x y = x + y<br>addB x = \y -> x + y<br>addC = \x -> \y -> x + y<br></div><div><br></div><div>and all three add two arguments just fine</div><div><br></div><div>> addA 2 3</div><div>5</div><div>> addB 2 3</div><div>5</div><div>> addC 2 3</div><div>5</div><div><br></div><div>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</div><div><br></div><div>(\x -> \y -> x + y) 2 3<br>(\y -> 2 + y) 3<br>(2 + 3)<br>5<br></div><div><br></div><div>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?</div><div><br></div><div>LB</div><div><br></div><div><br></div></div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div></div>