Advertisement
Guest User

Untitled

a guest
Apr 27th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. (defmacro* defrule (name (input-parameter &rest other-parameters) &rest body)
  2. `(defun ,(intern (format "parse-%s" name)) ,(cons input-parameter other-parameters)
  3. (unless (zerop (length ,input-parameter))
  4. ,@body)))
  5.  
  6. (macroexpand-1 '(defrule ordinary (input)
  7. (list (substring input 1 nil) (list 'literal (aref input 0)))))
  8. --> (defun parse-ordinary (input) (unless (zerop (length input)) (list (substring input 1 nil) (list (quote literal) (aref input 0)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement