Skip to content
Create a gist now

Instantly share code, notes, and snippets.

@densh /join.scala
Last active

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.