It's a lot prettier if you write it like this:

add(x) = f(y) = x + y

or with an anonymous function like this:

add(x) = y -> x + y


On Mon, Sep 1, 2014 at 5:17 PM, Michael Louwrens <
[email protected]> wrote:

> I just wanted to add an example of function currying in Julia.
>
> It isn't exactly pretty but it does work! I don't expect it to be
> performant however.
>
> julia> function Add(x)
>        return function f(y)
>        return x + y
>        end
>        end
>
> Add (generic function with 1 method)
>
> julia> Add(1)(2)
> 3
>
> A simple example, but it does show basic currying working fine.
>

Reply via email to