diff -r c82a45f48bfc -r 5365ef60707e progs/while-arrays/compile_arrays.sc --- a/progs/while-arrays/compile_arrays.sc Fri Oct 13 23:49:34 2023 +0100 +++ b/progs/while-arrays/compile_arrays.sc Sat Oct 21 09:09:09 2023 +0100 @@ -88,11 +88,12 @@ // convenient string interpolations // for generating instructions and labels -implicit def sring_inters(sc: StringContext) = new { +extension (sc: StringContext) { def i(args: Any*): String = " " ++ sc.s(args:_*) ++ "\n" def l(args: Any*): String = sc.s(args:_*) ++ ":\n" } + def compile_op(op: String) = op match { case "+" => i"iadd" case "-" => i"isub" @@ -215,14 +216,8 @@ // automating the above -// pre-2.5.0 ammonite -// import ammonite.ops._ - -// post 2.5.0 ammonite import os._ - - def compile_to_file(bl: Block, class_name: String) : Unit = write.over(pwd / s"$class_name.j", compile(bl, class_name)) @@ -246,5 +241,4 @@ -// runs with amm2 and amm3