[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: symbol-macrolet



I think there was an obvious bug in your example.  How about:

(defmacro â??2 (form &optional environment)
  (if (and (symbolp form)
           (eq (macroexpand-1 form environment) form) ; <-
      `(* ,form ,form)
      `(expt ,form 2)))

I tried to come up with another example.  This is more generic
(dispatching on whether the form is a symbol or not) but it seems
more lame.

(defun dispatch (form &optional environment)
  (if (symbolp form)
      (setq form (macroexpand-1 form environment)))
  (if (and (symbolp form)
           (special-symbol form))
       (dispatch-special-symbol form environment)
       (dispatch-form form envrionment)))


k