progs/fun/fun.sc
changeset 1031 b62c0002c735
parent 974 06148fc63273
equal deleted inserted replaced
1030:5cadcc5aee02 1031:b62c0002c735
    73 import scala.language.implicitConversions
    73 import scala.language.implicitConversions
    74 import scala.language.reflectiveCalls
    74 import scala.language.reflectiveCalls
    75 
    75 
    76 // convenience for code-generation (string interpolations)
    76 // convenience for code-generation (string interpolations)
    77 extension (sc: StringContext) {
    77 extension (sc: StringContext) {
    78   def i(args: Any*): String = "   " ++ sc.s(args:_*) ++ "\n"  // instructions
    78   def i(args: Any*): String = "   " ++ sc.s(args*) ++ "\n"  // instructions
    79   def l(args: Any*): String = sc.s(args:_*) ++ ":\n"          // labels
    79   def l(args: Any*): String = sc.s(args*) ++ ":\n"          // labels
    80   def m(args: Any*): String = sc.s(args:_*) ++ "\n"           // methods
    80   def m(args: Any*): String = sc.s(args*) ++ "\n"           // methods
    81 }
    81 }
    82 
    82 
    83 // variable / index environments
    83 // variable / index environments
    84 type Env = Map[String, Int]
    84 type Env = Map[String, Int]
    85 
    85