MMTMMT Docs
Diagnostics

T426

invalid lambda position or body

T426

A lambda exists only as the lambda argument of map, filter, or reduce, and its body is one expression without braces. Move the expression into the higher-order call, remove body braces, or declare a named function for reusable logic.

Failing example

script "conf"
data chart = subscribe(data.ohlcv)
on chart.update {
  let double = |x| x * 2.0
}

Corrected example

script "fixed"
data chart = subscribe(data.ohlcv)
state xs: float[] = float[](4)
on chart.update {
  let doubled = xs.map(|x| x * 2.0)
  let first = doubled.get(0)
}

On this page