All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.dev.inmo.micro_utils.matrix.MatrixBuilder.kt Maven / Gradle / Ivy

There is a newer version: 0.22.2
Show newest version
package dev.inmo.micro_utils.matrix

open class MatrixBuilder {
    private val mutMatrix: MutableList> = ArrayList()
    val matrix: Matrix
        get() = mutMatrix

    fun row(t: List) = mutMatrix.add(t)
    fun add(t: List) = mutMatrix.add(t)
    operator fun List.unaryPlus() = row(this)
    operator fun plus(t: List) = add(t)
    operator fun T.unaryPlus() = add(listOf(this))
}

fun  MatrixBuilder.row(block: RowBuilder.() -> Unit) = +RowBuilder().also(block).row
fun  MatrixBuilder.row(vararg elements: T) = +elements.toList()




© 2015 - 2024 Weber Informatics LLC | Privacy Policy