Skip to content

Commit

Permalink
Enhances example for Curried functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Cory Borg committed Jan 25, 2014
1 parent 8e7ec36 commit bdcbaba
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions web/basics.textile
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,14 @@ res1: Int = 6
You can take any function of multiple arguments and curry it. Let's try with our earlier <code>adder</code>

<pre>
scala> (adder _).curried
res1: (Int) => (Int) => Int = <function1>
scala> val curriedAdd = (adder _).curried
curriedAdd: Int => (Int => Int) = <function1>

scala> val addTwo = curriedAdd(2)
addTwo: Int => Int = <function1>

scala> addTwo(4)
res22: Int = 6
</pre>

h3. Variable length arguments
Expand Down

0 comments on commit bdcbaba

Please sign in to comment.