Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- println("hello there") //hello there
- //res0: Unit = ()
- def mapRangeSum(f: Int => Int)(start: Int, end: Int) = { //
- start to end map f sum //mapRangeSum: mapRangeSum[](val f: Int => Int)(val start: Int,val end: Int) => Int
- } //
- //
- println(mapRangeSum(x => x + 2)(1, 50)) //
- //1375
- val mapRangeSum1 = (f: Int => Int) => { //res1: Unit = ()
- (start: Int, end: Int) => { //
- (start to end).map(x => f(x)).sum //mapRangeSum1: (Int => Int) => ((Int, Int) => Int) = <function1>
- } //
- } //
- //
- println(mapRangeSum1(x => x + 2)(1, 50)) //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement