remove add and put column method in matrix row builder

This commit is contained in:
InsanusMokrassar 2021-02-11 15:07:24 +06:00
parent d41c3c2de4
commit b120fbd2b1

View File

@ -5,11 +5,10 @@ class RowBuilder<T> {
val row: Row<T>
get() = mutRow
fun add(t: T) = mutRow.add(t)
operator fun T.unaryPlus() = add(this)
fun column(t: T) = mutRow.add(t)
operator fun T.unaryPlus() = column(this)
}
fun <T> row(block: RowBuilder<T>.() -> Unit): List<T> = RowBuilder<T>().also(block).row
fun <T> RowBuilder<T>.column(element: T) = +element
fun <T> RowBuilder<T>.columns(elements: List<T>) = elements.forEach(::column)
fun <T> RowBuilder<T>.columns(vararg elements: T) = elements.forEach(::column)