`prev()?.newValue()` unavailable for add-multiple DSL
Jolanrensen opened this issue · 0 comments
Jolanrensen commented
As is described here, adding a single column allows you to access the previous row with prev()
and the new value of the previous row with prev().newValue<T>()
.
This enables:
df.add("fibonacci") {
if (index() < 2) 1
else prev()!!.newValue<Int>() + prev()!!.prev()!!.newValue<Int>()
}
I'd expect this to be equivalent:
df.add {
"fibonacci" from {
if (index() < 2) 1
else prev()!!.newValue<Int>() + prev()!!.prev()!!.newValue<Int>()
}
}
but unfortunately, since from {}
provides a DataRow
as context instead of AddDataRow
, newValue()
is unavailable.
I don't know whether this was done due to a technical limitation, but if it was an oversight it surely must be added.