I can’t find anything in the stdlib to do somethin...
# getting-started
j
I can’t find anything in the stdlib to do something like that:
Copy code
list.forEach {
    with(it) {
        // I want each value of the list as a receiver, not as a parameter.
    }
}
Am I missing an existing method or should I write my own
receiveEach
extension method?
r
As in this:
Copy code
fun <T> List<T>.receiveEach(f: T.() -> Unit) = forEach { it.f() }
I can't see anything like it in the stdlib.
j
yep, that’s what I meant 🙂
p
I can’t say I’ve ever needed something like that
4
j
Yeah, it’s really an edge-case, I’m not surprised ^^
but I thought I might ask
thank you anyway!
a