Comment

Comment by gizmo686

>Most functional programming languages with automatic currying have syntax where there is no difference between add(1, 2) and add(1)(2).

This isn't true of any functional programming language I can think of.

What happens in most functional programming languages is that it is idiomatic to make functions curried by defualt, and only make non-curried functions when you have reason to.

For example, in Haskell, you could have either:

    add1 :: Int -> Int -> Int
    add1 x y = x+y
    
    add2 :: (Int, Int) -> Int
    add2(x,y)=x+y
which would be called as:

    add1 2 3     --equivalent to (add1 2) 3
    add2(2,3)
There is even functions to convert between these:

    add1 = uncurry add2
    add2 = curry add1
parent gizmo686 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton