Is it possible to take a function with a generic t...
# announcements
l
Is it possible to take a function with a generic type parameter such as the following...
Copy code
fun <T: Any> printHash(t: T) = println(t.hashCode())
...and define it as a function literal? I was thinking something like
Copy code
val printHash: <T: Any> (T) -> Unit = fun(t: T) { println(t.hashCode()) }
But this doesn't compile. Tried moving the
<T: Any>
around to different places but I can't find anything that works.