Last active
March 6, 2021 21:46
-
-
Save deanwampler/62fa2e8d3d25c2dde249c80f9b1d56fa to your computer and use it in GitHub Desktop.
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
// Adapted from https://github.com/deanwampler/programming-scala-book-code-examples/blob/master/src/script/scala/progscala3/typesystem/poly/PolymorphicFunctions.scala | |
scala> def toMap[K,V](key: K)(value: V): Map[K,V] = Map(key -> value) | |
def toMap[K, V](key: K)(value: V): Map[K, V] | |
scala> toMap("one")(1.1) | |
val res0: Map[String, Double] = Map(one -> 1.1) | |
scala> toMap(2L)("two") | |
val res1: Map[Long, String] = Map(2 -> two) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment