Skip to content

Instantly share code, notes, and snippets.

@aoiroaoino
Created March 2, 2014 15:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aoiroaoino/9308248 to your computer and use it in GitHub Desktop.
Save aoiroaoino/9308248 to your computer and use it in GitHub Desktop.
for文で三角形
scala> import scala.language.experimental.macros
import scala.language.experimental.macros
scala> import scala.reflect.macros.Context
import scala.reflect.macros.Context
scala> def for_impl(c: Context) = c.universe.reify(println("*\n**\n***\n****\n***\n**\n*"))
for_impl: (c: scala.reflect.macros.Context)c.universe.Expr[Unit]
scala> def for文 = macro for_impl
for文: Unit
scala> for文
*
**
***
****
***
**
*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment