Skip to content

Instantly share code, notes, and snippets.

@kwmt
Created January 15, 2024 06:17
Show Gist options
  • Save kwmt/1cdaf33adea1fdf84758dcf5b8a4b025 to your computer and use it in GitHub Desktop.
Save kwmt/1cdaf33adea1fdf84758dcf5b8a4b025 to your computer and use it in GitHub Desktop.
fun main() {
val list = 0..<20
// https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/windowed.html
println(list.windowed(4,4))
// [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15], [16, 17, 18, 19]]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment