Skip to content

Commit 9cab2cc

Browse files
committed
Remove obsolete update.withExpression
1 parent 94b4e8a commit 9cab2cc

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/replace.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public fun <T> DataFrame<T>.replaceAll(
2525
columns: ColumnsSelector<T, *> = { allDfs() }
2626
): DataFrame<T> {
2727
val map = valuePairs.toMap()
28-
return update(columns).withExpression { map[it] ?: it }
28+
return update(columns).with { map[it] ?: it }
2929
}
3030

3131
public data class ReplaceCause<T, C>(val df: DataFrame<T>, val columns: ColumnsSelector<T, C>)

src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/update.kt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ public infix fun <T, C> Update<T, C>.perRowCol(expression: RowColumnExpression<T
5050
public typealias UpdateExpression<T, C, R> = AddDataRow<T>.(C) -> R
5151

5252
public infix fun <T, C> Update<T, C>.with(expression: UpdateExpression<T, C, C?>): DataFrame<T> =
53-
withExpression(expression)
53+
updateImpl { row, _, value ->
54+
expression(row, value)
55+
}
5456

5557
public fun <T, C> Update<T, C>.asNullable(): Update<T, C?> = this as Update<T, C?>
5658

@@ -63,11 +65,6 @@ public fun <T, C> Update<T, C>.perCol(values: AnyRow): DataFrame<T> = perCol(val
6365
public fun <T, C> Update<T, C>.perCol(valueSelector: Selector<DataColumn<C>, C>): DataFrame<T> =
6466
updateWithValuePerColumnImpl(valueSelector)
6567

66-
public fun <T, C> Update<T, C>.withExpression(expression: UpdateExpression<T, C, C?>): DataFrame<T> =
67-
updateImpl { row, _, value ->
68-
expression(row, value)
69-
}
70-
7168
internal infix fun <T, C> RowValueFilter<T, C>?.and(other: RowValueFilter<T, C>): RowValueFilter<T, C> {
7269
if (this == null) return other
7370
val thisExp = this
@@ -101,10 +98,10 @@ public fun <T> DataFrame<T>.update(
10198
vararg cols: String,
10299
expression: RowValueExpression<T, Any?, Any?>
103100
): DataFrame<T> =
104-
update(*headPlusArray(firstCol, cols)).withExpression(expression)
101+
update(*headPlusArray(firstCol, cols)).with(expression)
105102

106103
public fun <T, C> Update<T, C>.withNull(): DataFrame<T> = asNullable().withValue(null)
107104

108105
public fun <T, C> Update<T, C>.withZero(): DataFrame<T> = updateWithValuePerColumnImpl { 0 as C }
109106

110-
public infix fun <T, C> Update<T, C>.withValue(value: C): DataFrame<T> = withExpression { value }
107+
public infix fun <T, C> Update<T, C>.withValue(value: C): DataFrame<T> = with { value }

0 commit comments

Comments
 (0)