mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-09-23 17:51:31 +00:00
8 lines
197 B
Kotlin
8 lines
197 B
Kotlin
package gay.pizza.pork.compiler
|
|
|
|
class ComputableState<X, T>(val computation: (X) -> T) {
|
|
private val state = StoredState<X, T>()
|
|
|
|
fun of(key: X): T = state.computeIfAbsent(key, computation)
|
|
}
|