All pastes #796046 Raw Edit

Elisp macro tests

public text v1 · immutable
#796046 ·published 2007-11-24 18:36 UTC
rendered paste body
(defun foo (n)
  "Evaluates to n copies of the string 'foo', concatenated"
  (let ((result))
    (dotimes (i n)
      (setq result (concat result "foo")))
    result))

(defmacro this-macro-will-fail (arg)
  (list (foo arg)))

(defmacro this-macro-will-work (arg)
  `(foo ,arg))

(this-macro-will-fail 3)
(this-macro-will-work 3)