import treehugger.forest._import definitions._import treehuggerDSL._Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_51).Type in expressions to have them evaluated.Type :help for more information.scala> OBJECTDEF("MyObject") := BLOCK(| LIT(0)| )res0: treehugger.forest.ModuleDef = ModuleDef(Modifiers(, , Map()),MyObject,Template(List(),ValDef(Modifiers(private, , Map()),Ident(_),EmptyTree),List(Literal(Constant(0)))))scala> treeToString(res0)res1: String =object MyObject {0}
scala> def foo(valStrings: List[String]): Tree =| OBJECTDEF("MyObject") := BLOCK(valStrings map { x =>| VAL(x) := LIT(0)| }: _*)foo: (valStrings: List[String])treehugger.forest.Tree
scala> treeToString(foo(List("a", "b", "c")))res2: String =object MyObject {val a = 0val b = 0val c = 0}
scala> def foo(valStrings: List[String]): Tree =| OBJECTDEF("MyObject") := BLOCK(valStrings map { x =>| VAL(x) := REF("f") APPLY (LIT(x))| }: _*)foo: (valStrings: List[String])treehugger.forest.Treescala> treeToString(foo(List("a", "b", "c")))res3: String =
object MyObject {val a = f("a")val b = f("b")val c = f("c")}
--
You received this message because you are subscribed to the Google Groups "treehugger-scala" group.
To unsubscribe from this group and stop receiving emails from it, send an email to treehugger-sca...@googlegroups.com.
To post to this group, send email to treehugg...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/treehugger-scala/CAA%3DX4OA01qW23d%3DvyEoC1RZEHgk07R7D0eiipry9OxtcLr0gvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.