commonMain.it.unibo.tuprolog.solve.channel.impl.InputChannelFromString.kt Maven / Gradle / Ivy
package it.unibo.tuprolog.solve.channel.impl
internal class InputChannelFromString(
private val string: String,
) : AbstractInputChannel() {
private val iterator by lazy {
string.lineSequence()
.flatMap { it.toCharArray().asSequence() + sequenceOf('\n') }
.map { "$it" }
.iterator()
}
override fun readActually(): String? = if (iterator.hasNext()) iterator.next() else null
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy