<@U0U0R5UHM>: like this: ``` public inline fun &lt...
# announcements
o
@sdavids: like this:
Copy code
public inline fun <T, K, V> Iterable<T>.associateFoldBy(initial:V, keySelector: (T) -> K, operation: (V, T) -> V): Map<K,V> {
    val destination = LinkedHashMap<K, V>()
    for (element in this) {
        val key = keySelector(element)
        val current = destination.getOrPut(key) { initial }
        destination.put(key, operation(current, element))
    }
    return destination
}
and use like
Copy code
list.associateFoldBy(0, { it }, { it + 1 })