Ulrich Schuster
12/25/2024, 1:36 PMf(x: X, (X) -> Y): Y
that takes some argument x: X
and a function (X) -> Y
. And I have a concrete function with receiver, say Int.makeY(x: X): Y
. I would like to partially apply makeY
to a given receiver and pass it to f
, like
val foo = 5
f(x) { foo::makeY }
However, this results in an ArgumentTypeMismatch compilation error, stating that Y
was expected instead of the provided function reference. Am I simply making a mistake in my declaration, or is it simply not possible to pass a partially applied function with receiver as reference?Emil Kantis
12/25/2024, 1:55 PM() -> (X) -> Y
by passing the reference inside a lambda. Does it work with f(x, foo::makeY)?
Ulrich Schuster
12/25/2024, 2:16 PM