; Fieldtest mut-local #4 — Bool mut-var "found-a-factor" flag. ; ; Task: probe whether n has a small prime factor (2, 3, 5, or 7) by ; running four straight-line checks; if any check matches, set a Bool ; mut-var to true. Print the flag at the end. ; ; The straight-line form here is the natural shape: an LLM-author asked ; to "test these four conditions and OR the results" would otherwise ; write a chain of `||` operators (no such operator in AILang surface) ; or a nested chain of `(if ... (if ... ))`. The mut form replaces both ; with a flat sequence whose intent ("set this flag if any of these ; matches") reads top-to-bottom. ; ; Test against n = 91 = 7 * 13 — only the divisible-by-7 check fires. ; Expected stdout: true (module mut-local_4_has_small_factor (fn has_small_factor (type (fn-type (params (con Int)) (ret (con Bool)))) (params n) (body (mut (var found (con Bool) false) (if (app == (app % n 2) 0) (assign found true) (lit-unit)) (if (app == (app % n 3) 0) (assign found true) (lit-unit)) (if (app == (app % n 5) 0) (assign found true) (lit-unit)) (if (app == (app % n 7) 0) (assign found true) (lit-unit)) found))) (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body (app print (app has_small_factor 91)))))