There is already slice
for collections, it’s beter semantically than typing out take(...).drop(...)
(which has bounds in the wrong order), and it’s trivial to implement:
fun <T> Sequence<T>.slice(indices: IntRange): Sequence<T> = take(indices.endInclusive + 1).drop(indices.start)
Could someone please make it happen?
submitted by /u/NateReinarWindwood
[link] [comments]