How to do that in nice declarative style? Somehow ...
# announcements
j
How to do that in nice declarative style? Somehow with
map
operator?
r
Copy code
fun <T> UserApi.map(mappingF: (UserApi) -> T) : T  = mappingF(this)
then
Copy code
UserApi("a", 1, "b").map { User(it.name, it.age) }
t
you are just redefining
let
.
map
makes no sense here because
UserApi
is not a functor
r
True ... I forgot about
let
🙂 and I tried to not mention Functor as I had no intention to explain it