Support 'windowed' intermediate call

This commit is contained in:
Vitaliy.Bibaev
2017-12-22 11:06:39 +03:00
committed by Yan Zhulanow
parent cc549d3ae5
commit 449fa8f3ec
7 changed files with 126 additions and 10 deletions
@@ -2,9 +2,39 @@ LineBreakpoint created at Windowed.kt:5
Run Java
Connected to the target VM
Windowed.kt:5
Exception caught: junit.framework.AssertionFailedError: Unresolved reference: it, Unresolved reference: it
intArrayOf(1, 1, 1, 1, 1, 1, 1).asSequence()
.windowed(3, transform = { it.sum() })
.count()
windowed
before: 1,2,3,5,7,9,11
after: 4,6,8,10,12
count
before: 4,6,8,10,12
after: nothing
mappings for windowed
direct:
1 -> 4
2 -> 4,6
3 -> 4,6,8
5 -> 6,8,10
7 -> 8,10,12
9 -> nothing
11 -> nothing
reverse:
1,2,3 <- 4
2,3,5 <- 6
3,5,7 <- 8
5,7 <- 10
7 <- 12
mappings for count
direct:
4 -> nothing
6 -> nothing
8 -> nothing
10 -> nothing
12 -> nothing
reverse:
empty
Disconnected from the target VM
WRONG!
Process finished with exit code 0
@@ -2,9 +2,37 @@ LineBreakpoint created at WindowedWithPartial.kt:5
Run Java
Connected to the target VM
WindowedWithPartial.kt:5
Exception caught: junit.framework.AssertionFailedError: Expected: <null> but was: CHAIN_CONSTRUCTION, Expected: <null> but was: CHAIN_CONSTRUCTION
listOf(1, 1, 1, 1, 1).asSequence()
.windowed(3, partialWindows = true, transform = { it.size })
.count()
windowed
before: 1,2,3,5,7
after: 4,6,8,9,10
count
before: 4,6,8,9,10
after: nothing
mappings for windowed
direct:
1 -> 4
2 -> 4,6
3 -> 4,6,8
5 -> 6,8,9
7 -> 8,9,10
reverse:
1,2,3 <- 4
2,3,5 <- 6
3,5,7 <- 8
5,7 <- 9
7 <- 10
mappings for count
direct:
4 -> nothing
6 -> nothing
8 -> nothing
9 -> nothing
10 -> nothing
reverse:
empty
Disconnected from the target VM
WRONG!
Process finished with exit code 0
@@ -2,5 +2,5 @@ package misc
fun main(args: Array<String>) {
// Breakpoint!
intArrayOf(1, 1, 1, 1, 1, 1, 1).asSequence().windowed(3) { it.sum() }.count()
intArrayOf(1, 1, 1, 1, 1, 1, 1).asSequence().windowed(3, transform = { it.sum() }) .count()
}
@@ -2,5 +2,5 @@ package misc
fun main(args: Array<String>) {
// Breakpoint!
listOf(1, 1, 1, 1, 1).windowed(3, partialWindows = true) { it.size }.count()
listOf(1, 1, 1, 1, 1).asSequence().windowed(3, partialWindows = true, transform = { it.size }).count()
}
@@ -1,4 +1,3 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package sort
fun main(args: Array<String>) {
@@ -6,4 +5,4 @@ fun main(args: Array<String>) {
arrayOf(Person("Bob", 42), Person("Alice", 27)).asSequence().sortedBy { it.age }.count()
}
internal data class Person(val name: String, val age: Int)
data class Person(val name: String, val age: Int)