soma.cell

E0072: quadratic_concat

E0072 quadratic_concat — a list or string grown by concatenation in a loop.

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

The rule

A String or List grown with out = out + piece inside a loop copies the whole value at each step, so the loop is quadratic. soma check warns about this under the code W0014 (habit_warning). Push the pieces to a List and join(parts, "") once (in a [native] handler, use strbuf / sb_push / sb_finish).

When you see it

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