hy/tests/native_tests/native_macros.hy

11 lines
278 B
Hy
Raw Normal View History

2013-05-11 19:40:48 +02:00
(defn test-rev-macro []
"NATIVE: test stararged native macros"
(defmacro rev [&rest body]
"Execute the `body` statements in reverse"
(+ (quote (do)) (list (reversed body))))
(setv x [])
(rev (.append x 1) (.append x 2) (.append x 3))
(assert (= x [3 2 1])))