Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmacro defrule (name lambda-list &rest body)
- (destructuring-bind (input-parameter &rest other-parameters) lambda-list
- `(defun ,(intern (format "parse-%s" name)) ,(cons input-parameter other-parameters)
- (unless (zerop (length ,input-parameter))
- ,@body))))
- (macroexpand-1 '(defrule ordinary (input)
- (list (substring input 1 nil) (list 'literal (aref input 0)))))
- --> (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