public
Last active

  • Download Gist
join.scala
Scala
1 2 3 4 5 6 7 8 9 10 11
import scala.reflect.makro.Context
 
object Macros {
def join_impl(c: Context)(a: c.Tree): c.Tree = {
import c.universe._
import definitions._
val q"{ ..$stats }" = a
stats.foldRight(q"$NilModule") { (el, acc) => q"$acc :: $el" }
}
def join(a: Int): List[Int] = macro join_impl
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.