soma.cell

E0082: lambda_assign

E0082 lambda_assign — a lambda assigns an outer local.

A compile-time error of soma check, the checker of the Soma programming language (soma explain E0082).

The rule

Assigning an outer local inside a lambda (sum_total = sum_total + p) changes a copy: the outer variable is unchanged afterwards. soma check warns about this under the code W0014 (habit_warning). Accumulate with a for loop, or with reduce / sum over the list.

When you see it

soma check reports this rule (kind lambda_assign) as the warning W0014 habit_warning, never as E0082: the checker files every "habit" issue under W0014.