munificent / craftinginterpreters

Repository for the book "Crafting Interpreters"
http://www.craftinginterpreters.com/
Other
9.02k stars 1.06k forks source link

Slightly confusing sidebar in Section 10.1 #743

Closed andrewtyped closed 4 years ago

andrewtyped commented 4 years ago

The sidebar about function currying in section 10.1 ends with:

This style, called currying, after Haskell Curry (the same guy whose first name graces that other well-known functional language), is baked directly into the language syntax so it’s not as cumbersome as it would be here.

It's not clear what we're comparing that is more or less cumbersome than lox's syntax for currying. I looked up how Haskell does this with arrows, like f :: a -> b -> c. Is that what I should take away - that such notation is cleaner than lox's style of f(a)(b)(c)?

I'm really enjoying the book by the way, it's great we have this kind of teaching resource available.

munificent commented 4 years ago

I looked up how Haskell does this with arrows, like f :: a -> b -> c.

That syntax for declaring a function's type. The function declaration itself just looks like:

f a b c = a + b + c

And you can call it like:

f 1 2 3

Is that what I should take away - that such notation is cleaner than lox's style of f(a)(b)(c)?

Yup! :)