is there a shorter way to rewrite this? ``` fun &l...
# coroutines
k
is there a shorter way to rewrite this?
Copy code
fun <T : Comparable<T>> ClosedRange<T>.toSequence(succ: T.() -> T) = buildSequence {
    var e = start
    while (e <= endInclusive) {
        yield(e)
        e = e.succ()
    }
}
It's my coroutinification of
Copy code
fun <T : Comparable<T>> ClosedRange<T>.toSequence(succ: T.() -> T) =
        generateSequence(start, succ).takeWhile { it <= endInclusive }