Tags
#odersky-programming-in-scala-2ed #scala
Question
How to rewrite this using curried function (using compact notation)?
scala> def plainOldSum(x: Int, y: Int) = x + y
plainOldSum: (x: Int,y: Int)Int
scala> plainOldSum(1, 2)
res4: Int = 3

scala> def curriedSum(x: Int)(y: Int) = x + y
curriedSum: (x: Int)(y: Int)Int
scala> curriedSum(1)(2)
res5: Int = 3


Tags
#odersky-programming-in-scala-2ed #scala
Question
How to rewrite this using curried function (using compact notation)?
scala> def plainOldSum(x: Int, y: Int) = x + y
plainOldSum: (x: Int,y: Int)Int
scala> plainOldSum(1, 2)
res4: Int = 3

?

Tags
#odersky-programming-in-scala-2ed #scala
Question
How to rewrite this using curried function (using compact notation)?
scala> def plainOldSum(x: Int, y: Int) = x + y
plainOldSum: (x: Int,y: Int)Int
scala> plainOldSum(1, 2)
res4: Int = 3

scala> def curriedSum(x: Int)(y: Int) = x + y
curriedSum: (x: Int)(y: Int)Int
scala> curriedSum(1)(2)
res5: Int = 3

If you want to change selection, open document below and click on "Move attachment"

#### pdf

cannot see any pdfs

#### Summary

status measured difficulty not learned 37% [default] 0

No repetitions