Last active
December 18, 2021 15:20
-
-
Save j-thepac/781d4c99d5f7dc7bc434eeda78e010b7 to your computer and use it in GitHub Desktop.
SimpleFunctor
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
| case class Bag[Int](a: Int) { | |
| def map[Double](f: Int => Double): Bag[Double] = Bag(f(a)) | |
| } | |
| val f = i:Int => i/1.0 | |
| Bag(10).map( i=> f(i))//result =Bag(10.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment