diff --git a/impls/scala/step8_macros.scala b/impls/scala/step8_macros.scala index 5ac963a4d9..0ee23310db 100644 --- a/impls/scala/step8_macros.scala +++ b/impls/scala/step8_macros.scala @@ -91,7 +91,7 @@ object step8_macros { ast = quasiquote(a1) // continue loop (TCO) } case Symbol("defmacro!") :: a1 :: a2 :: Nil => { - val f = EVAL(a2, env) + val f = EVAL(a2, env).clone() f.asInstanceOf[MalFunction].ismacro = true return env.set(a1.asInstanceOf[Symbol], f) } diff --git a/impls/scala/step9_try.scala b/impls/scala/step9_try.scala index 536ddb42a4..828511070b 100644 --- a/impls/scala/step9_try.scala +++ b/impls/scala/step9_try.scala @@ -91,7 +91,7 @@ object step9_try { ast = quasiquote(a1) // continue loop (TCO) } case Symbol("defmacro!") :: a1 :: a2 :: Nil => { - val f = EVAL(a2, env) + val f = EVAL(a2, env).clone() f.asInstanceOf[MalFunction].ismacro = true return env.set(a1.asInstanceOf[Symbol], f) } diff --git a/impls/scala/stepA_mal.scala b/impls/scala/stepA_mal.scala index d4cc528b46..878cfc2baa 100644 --- a/impls/scala/stepA_mal.scala +++ b/impls/scala/stepA_mal.scala @@ -91,7 +91,7 @@ object stepA_mal { ast = quasiquote(a1) // continue loop (TCO) } case Symbol("defmacro!") :: a1 :: a2 :: Nil => { - val f = EVAL(a2, env) + val f = EVAL(a2, env).clone() f.asInstanceOf[MalFunction].ismacro = true return env.set(a1.asInstanceOf[Symbol], f) }