Created
May 22, 2020 09:09
-
-
Save ruurtjan/c9ce260cc1b3ef7b65b3d5815aee21d8 to your computer and use it in GitHub Desktop.
functional-dsl-blog-5.scala
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
object Original { | |
def flatMap[A, B](l: List[A], f: A => List[B]): List[B] = ??? | |
def flatten[A](l: List[List[A]]): List[A] = | |
Original.flatMap(l, (as: List[A]) => as) | |
def map[A, B](l: List[A], f: A => B): List[B] = | |
Original.flatMap(l, List(_)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment