pub fn recognize_zip_sum(
stmts: &[Stmt<'_>],
interner: &Interner,
) -> Result<ZipSum, ZipReject>Expand description
Recognize a zip sum anywhere in a LOGOS statement list:
Let mutable s be 0.
Let mutable i be 0.
While i is less than n:
Let date be item (i + 1) of dates.
If date is greater than 0 and date is less than 9999:
Set s to s + item (i + 1) of prices * item (i + 1) of discts.
Set i to i + 1.The loop is counted (its counter set to a constant right before it, stepped by one), the accumulator
starts at zero right before it, every array is a declared Seq of Int read at the same unit-stride index, the
accumulation is Set s to s + E or an If whose arms are each exactly one such accumulation (a missing Else
adds 0), and the body holds nothing else but immutable names for elements and subterms. The first loop that is
one is returned; otherwise the refusal of the loop that came closest.