Created
August 6, 2015 23:02
-
-
Save cvogt/d84914f8d9c4c908828e to your computer and use it in GitHub Desktop.
mapValues is lazy
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
scala> def foo = { val x = Map[Any,Any](() -> ()).mapValues(_ => ???); () } | |
foo: Unit | |
scala> foo | |
scala> def foo = { val x = Map[Any,Any](() -> ()).map(_ => ???); () } | |
foo: Unit | |
scala> foo | |
scala.NotImplementedError: an implementation is missing | |
at scala.Predef$.$qmark$qmark$qmark(Predef.scala:252) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This example made me poke around Haskell's
Data.Map
: