T427
invalid lambda parameter list
Severity Error
The lambda has the wrong number of parameters for the method it is passed to. map, filter, any, all and count take a one-parameter lambda (v => ...); reduce takes an accumulator and an element ((acc, v) => ...) with two different names.
Adjust the parameter list to the method.
Failing example
script "Sum of large prints"
data tape = subscribe(data.trades, minNotional: 100_000.0)
state recent = rolling<float>(20)
on tape.trade(tr) {
recent.push(tr.notional)
let total = recent.reduce(0.0, v => v + v)
log.debug(str.formatVolume(total))
}Fixed example
script "Sum of large prints"
data tape = subscribe(data.trades, minNotional: 100_000.0)
state recent = rolling<float>(20)
on tape.trade(tr) {
recent.push(tr.notional)
let total = recent.reduce(0.0, (acc, v) => acc + v)
log.debug(str.formatVolume(total))
}