June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,4 +1,4 @@
|
|||
proc `^`*[T: SomeInteger](base: T, exp: T): T =
|
||||
proc `^`*[T: SomeInteger](base, exp: T): T =
|
||||
var (base, exp) = (base, exp)
|
||||
result = 1
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
template times(x: expr, y: stmt): stmt =
|
||||
template times(x, y: untyped): untyped =
|
||||
for i in 1..x:
|
||||
y
|
||||
|
||||
10.times: # or times 10:
|
||||
10.times: # or times 10: or times(10):
|
||||
echo "hi"
|
||||
echo "bye"
|
||||
|
|
|
|||
11
Task/Metaprogramming/Scala/metaprogramming.scala
Normal file
11
Task/Metaprogramming/Scala/metaprogramming.scala
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import scala.language.experimental.macros
|
||||
import scala.reflect.macros.Context
|
||||
|
||||
object Macros {
|
||||
def impl(c: Context) = {
|
||||
import c.universe._
|
||||
c.Expr[Unit](q"""println("Hello World")""")
|
||||
}
|
||||
|
||||
def hello: Unit = macro impl
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue