Skip to content

Commit aaa9dde

Browse files
committed
wip column expressions expr {}
1 parent da93583 commit aaa9dde

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import org.jetbrains.kotlinx.dataframe.impl.columns.top
4141
import org.jetbrains.kotlinx.dataframe.impl.columns.transform
4242
import org.jetbrains.kotlinx.dataframe.impl.columns.transformSingle
4343
import org.jetbrains.kotlinx.dataframe.impl.columns.tree.dfs
44+
import org.jetbrains.kotlinx.dataframe.documentation.*
4445
import kotlin.reflect.KProperty
4546
import kotlin.reflect.KType
4647
import kotlin.reflect.typeOf
@@ -638,6 +639,11 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
638639
toColumnAccessor().colsOf(type, filter)
639640
}
640641

642+
/**
643+
* @include [ColumnExpression]
644+
*
645+
* TODO
646+
*/
641647
public inline fun <T, reified R> ColumnsSelectionDsl<T>.expr(
642648
name: String = "",
643649
infer: Infer = Infer.Nulls,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.jetbrains.kotlinx.dataframe.documentation
2+
3+
import org.jetbrains.kotlinx.dataframe.api.*
4+
5+
/**
6+
* ## Column Expression
7+
* In many DSLs, the lambda `expr {}` can be used to
8+
* create a temporary new column by defining an expression to fill up each row.
9+
*
10+
* These DSLs include (but are not limited to):
11+
* [The Add DSL][AddDsl.expr], [The Columns Selection DSL][ColumnsSelectionDsl.expr], and
12+
* [The Create DataFrame DSL][CreateDataFrameDsl.expr].
13+
*
14+
* The `expr {}` call functions like a mapping statement iterating over the object it's called on.
15+
*
16+
* TODO examples
17+
*/
18+
internal interface ColumnExpression

0 commit comments

Comments
 (0)