Last active
August 10, 2017 09:58
-
-
Save abdheshkumar/f36e783fd1d6f1305bda4abd61a74bc5 to your computer and use it in GitHub Desktop.
Function Translation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val fun: ((Int, Int)) => Int = (kv: Tuple2[Int, Int]) => kv match { | |
| case (k, v) => k + v | |
| } | |
| val fun1: Function1[Tuple2[Int, Int], Int] = (kv: Tuple2[Int, Int]) => kv match { | |
| case (k, v) => k + v | |
| } | |
| val myMap = Map(1 -> 2, 2 -> 3) | |
| myMap.map(fun) | |
| import scala.reflect.runtime.universe._ | |
| show { reify { | |
| myMap.map { case (k, v) => k + v } | |
| } } | |
| myMap.map(((x0$1) => x0$1 match { | |
| case Tuple2((k @ _), (v @ _)) => k.$plus(v) | |
| }))(Iterable.canBuildFrom) | |
| /* | |
| fun: ((Int, Int)) => Int = $Lambda$3060/1806134073@308879a4 | |
| fun1: ((Int, Int)) => Int = $Lambda$3061/275256199@7c5c3836 | |
| myMap: scala.collection.immutable.Map[Int,Int] = Map(1 -> 2, 2 -> 3) | |
| res0: scala.collection.immutable.Iterable[Int] = List(3, 5) | |
| import scala.reflect.runtime.`package`.universe._ | |
| res1: String = Expr[scala.collection.immutable.Iterable[Int]](A$A282.myMap.map(((x0$1) => x0$1 match { | |
| case Tuple2((k @ _), (v @ _)) => k.$plus(v) | |
| }))(Iterable.canBuildFrom)) | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment