It's great that you can pass method references as ...
# announcements
h
It's great that you can pass method references as arguments like so:
Copy code
operator fun Vector.times(scalar: Double) = mapToVector(scalar::times)
but since division isn't commutative, i can't use the same syntax for that, unless there's a way I don't know of?
Copy code
operator fun Vector.div(divisor: Double) = mapToVector { it / divisor }
d
You could 0ass
divisor
as a second parameter to mapToVector and expect a lambda that takes 2 doubles, the second one being the divisor. Then you can pass Double::div.