Skip to content

@densh /join.scala
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.