; Fieldtest mut-local #1 — factorial 5! via straight-line mut updates. ; ; Task: print 5! (= 120) using a `mut` block that names a running ; product and unrolls five multiplications as straight-line statements. ; This is the most direct possible use of mut-local: no helper fn, no ; iteration, just a sequence of in-block updates terminated by reading ; the var. The LLM-author's mental model of "I want a local accumulator" ; maps 1:1 onto the surface here. ; ; Why this fits mut-local's scope: the milestone supplies only sealed ; lexically-scoped mutables, with no `while` or `for`. Straight-line ; unroll is the *only* shape inside one mut block that needs no helper. ; ; Expected stdout: 120 (module mut-local_1_factorial (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body (app print (mut (var prod (con Int) 1) (assign prod (app * prod 1)) (assign prod (app * prod 2)) (assign prod (app * prod 3)) (assign prod (app * prod 4)) (assign prod (app * prod 5)) prod)))))