fix zipWithNextCircular on single element
This commit is contained in:
parent
5965ca940b
commit
e76d8e0774
@ -9,7 +9,7 @@ package space.kscience.kmath.misc
|
||||
* The same as [zipWithNext], but includes link between last and first element
|
||||
*/
|
||||
public inline fun <T, R> List<T>.zipWithNextCircular(transform: (a: T, b: T) -> R): List<R> {
|
||||
if (isEmpty()) return emptyList()
|
||||
if (size < 2) return emptyList()
|
||||
return indices.map { i ->
|
||||
if (i == size - 1) {
|
||||
transform(last(), first())
|
||||
|
Loading…
Reference in New Issue
Block a user