6 ms·
That last one is an interesting example. If I needed to do that, I would write something like this (in Kotlin, my daily-driver language): fun foo(list: Lis
by koreth1 3y ago
That last one is an interesting example. If I needed to do that, I would write something like this (in Kotlin, my daily-driver language):
fun foo(list: List<Bar>) =
list.filter { condition(it) }.associateWith { transform(it) }
which would take me less time to write than the prompt would.
However, if I didn't know Kotlin very well, I might have had to go look in the docs to find the associateWith function (or worse, I might not have even thought to look for it) at which point the prompt would have saved me time and taught me that the function exists.