(.module: [lux (#- Scope) [abstract ["." monad (#+ do)]] [data ["." product] ["." text format] [collection ["." list ("#;." functor)]]] [target ["_" scheme (#+ Computation Var)]]] ["." // #_ [runtime (#+ Operation Phase)] ["#." case] ["#/" // ["#/" // [// [synthesis (#+ Scope Synthesis)]]]]]) (def: @scope (_.var "scope")) (def: #export (scope generate [start initsS+ bodyS]) (-> Phase (Scope Synthesis) (Operation Computation)) (do ////.monad [initsO+ (monad.map @ generate initsS+) bodyO (///.with-anchor @scope (generate bodyS))] (wrap (_.letrec (list [@scope (_.lambda [(|> initsS+ list.enumerate (list;map (|>> product.left (n/+ start) //case.register))) #.None] bodyO)]) (_.apply/* @scope initsO+))))) (def: #export (recur generate argsS+) (-> Phase (List Synthesis) (Operation Computation)) (do ////.monad [@scope ///.anchor argsO+ (monad.map @ generate argsS+)] (wrap (_.apply/* @scope argsO+))))