Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Output<U : Term>(val name: String) {
- private val callbacks: MutableList<suspend (U) -> Boolean> = mutableListOf()
- fun connect(input: Input<out U>) {
- // input.callback is suspend (U) -> Boolean
- this.callbacks.add(input.callback)
- }
- suspend fun yield(term: U) {
- callbacks.forEach {
- it(term)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment