[User]
Define a macro that eliminates this repetitive pattern:
(check-cursor-attached cluffer:beginning-of-buffer-p (cursor))

Issue: Macro call that should be transformed by check-cursor-attached

(check-cursor-attached cluffer:beginning-of-buffer-p (cursor))

[Assistant]
(defmacro check-cursor-attached (name arguments)
  (let ((args (substitute '(cursor cluffer:cursor) 'cursor arguments)))
    `(defmethod ,name :before ,args
       (declare (ignore ,@(set-difference (remove 'cursor arguments)
                                          lambda-list-keywords)))
       (unless (cluffer:cursor-attached-p cursor)
         (error 'cluffer:cursor-detached)))))

;; macroexpand:
(defmethod cluffer:beginning-of-buffer-p :before ((cursor cluffer:cursor)) (declare (ignore)) (unless (cluffer:cursor-attached-p cursor) (error (quote cluffer:cursor-detached))))


[User]
Generate a defmacro form that transforms code like this:
(the 'some-name)

Pattern to recognize: Macro call that should be transformed by THE

(the 'some-name)

[Assistant]
(defmacro THE ...)

;; macroexpand:
(send self 'some-name)


[User]
Generate a defmacro form that transforms code like this:
(fgathering nil
  :key
  nil)

Pattern to recognize: Macro call that should be transformed by FGATHERING

(fgathering nil
  :key
  nil)

[Assistant]
(defmacro FGATHERING ...)

;; macroexpand:
(flet ()
  :key
  nil
  (values))


[User]
Define a macro that eliminates this repetitive pattern:
(with-sql-logging (mapc #'execute-sql (table-definition class)))

Issue: Macro call that should be transformed by with-sql-logging

(with-sql-logging (mapc #'execute-sql (table-definition class)))

[Assistant]
(defmacro with-sql-logging (&body body)
  `(let ((*mito-logger-stream* *mito-migration-logger-stream*))
     (with-trace-sql ,@body)))

;; macroexpand:
(let ((*mito-logger-stream* *mito-migration-logger-stream*)) (with-trace-sql (mapc (function execute-sql) (table-definition class))))


[User]
You are a Common Lisp macro expert. Given this code pattern:
(destructuring-bind () nil)

Write a macro that addresses: Macro call that should be transformed by DESTRUCTURING-BIND

(destructuring-bind () nil)

[Assistant]
(defmacro DESTRUCTURING-BIND ...)

;; macroexpand:
(sb-int:binding* ((nil (sb-c::check-ds-list nil 0 0 'nil))))


[User]
Generate a defmacro form that transforms code like this:
(lambda-ignoring-_ (exp1 _ exp2) `(,op ,exp1 ,exp2))

Pattern to recognize: Macro call that should be transformed by lambda-ignoring-_

(lambda-ignoring-_ (exp1 _ exp2) `(,op ,exp1 ,exp2))

[Assistant]
(defmacro lambda-ignoring-_ (lambda-list &body body)
  "Works like `cl:lambda' macro except automatically `declare's
 `ignore' for parameters beginning with '_' character."
  (let ((ignored-parameters
          (collect-_-symbol-in-lambda-list lambda-list)))
    (unless ignored-parameters
      (warn "No ignored parameters in: ~A" lambda-list))
    (multiple-value-bind (body decls doc)
        (parse-body body :documentation t)
      `(lambda ,lambda-list
         ,@ (if doc `(,doc))
         (declare (ignore ,@ignored-parameters))
         ,@decls
         ,@body))))

;; macroexpand:
(lambda (exp1 _ exp2) (declare (ignore _)) (sb-int:quasiquote (#S(sb-impl::comma :expr op :kind 0) #S(sb-impl::comma :expr exp1 :kind 0) #S(sb-impl::comma :expr exp2 :kind 0))))


[User]
Create a Common Lisp macro for the following transformation. Before code:
(atomically nil () (symbol-name 'this))

What needs to change: Macro call that should be transformed by atomically

(atomically nil () (symbol-name 'this))

[Assistant]
(defmacro atomically (invariant &body args)
  "Encloses atomic flow block of code that can be dispatched
concurrently. Non-consing."
  (destructuring-bind (opts lambda-list body) (parse-atomic-block-args args)
    (flow-lambda-macro (flow-context)
      (with-flow-function-macro (body-fu lambda-list body)
        `(dispatch-atomically ,flow-context #',body-fu ,invariant ,@opts)))))

;; macroexpand:
(%flow-lambda (#:flow-context155) (%with-flow-function (#:body-fu156 nil (symbol-name (quote this))) (dispatch-atomically #:flow-context155 (function #:body-fu156) nil)))


[User]
Generate a defmacro form that transforms code like this:
(with-context (context) (call-next-method))

Pattern to recognize: Macro call that should be transformed by with-context

(with-context (context) (call-next-method))

[Assistant]
(defmacro with-context ((context) &body body)
  `(let* ((*context* ,context)
          (*request* (context :request))
          (*response* (context :response))
          (*session* (context :session)))
     ,@body))

;; macroexpand:
(let* ((*context* context) (*request* (context :request)) (*response* (context :response)) (*session* (context :session))) (call-next-method))


[User]
Create a Common Lisp macro for the following transformation. Before code:
(do-matches (match-start match-end regex target-string (nreverse result-list) :start start :end end) (push match-start result-list) (push match-end result-list))

What needs to change: Macro call that should be transformed by do-matches

(do-matches (match-start match-end regex target-string (nreverse result-list) :start start :end end) (push match-start result-list) (push match-end result-list))

[Assistant]
(defmacro do-matches ((match-start match-end regex
                                   target-string
                                   &optional result-form
                                   &key start end)
                      &body body)
  "Iterates over TARGET-STRING and tries to match REGEX as often as
possible evaluating BODY with MATCH-START and MATCH-END bound to the
start/end positions of each match in turn.  After the last match,
returns RESULT-FORM if provided or NIL otherwise.  An implicit block
named NIL surrounds DO-MATCHES; RETURN may be used to terminate the
loop immediately.  If REGEX matches an empty string the scan is
continued one position behind this match.  BODY may start with
declarations."
  ;; this is a simplified form of DO-SCANS - we just provide two dummy
  ;; vars and ignore them
  (with-unique-names (reg-starts reg-ends)
    `(do-scans (,match-start ,match-end
                ,reg-starts ,reg-ends
                ,regex ,target-string
                ,result-form
                :start ,start :end ,end)
      ,@body)))

;; macroexpand:
(do-scans (match-start match-end #:reg-starts139 #:reg-ends140 regex target-string (nreverse result-list) :start start :end end) (push match-start result-list) (push match-end result-list))


[User]
Create a Common Lisp macro for the following transformation. Before code:
(define-modf-rewrite caaaar (expr) `(car (caaar ,(second expr))))

What needs to change: Macro call that should be transformed by define-modf-rewrite

(define-modf-rewrite caaaar (expr) `(car (caaar ,(second expr))))

[Assistant]
(defmacro define-modf-rewrite (name (expr) &body body)
  "Define a new rewrite rule.  If a form starting with NAME is encountered, call
the defined function to return a form that we can deal with (i.e. one defined
via DEFINE-MODF-EXPANDER, DEFINE-MODF-FUNCTION, and DEFINE-MODF-METHOD)."
  `(eval-when (:compile-toplevel :load-toplevel :execute)
     (setf (gethash ',name *modf-rewrites*)
           (lambda (,expr)
             ,@body))))

;; macroexpand:
(eval-when (:compile-toplevel :load-toplevel :execute) (setf (gethash (quote caaaar) *modf-rewrites*) (lambda (expr) (sb-int:quasiquote (car (caaar #S(sb-impl::comma :expr (second expr) :kind 0)))))))


[User]
You are a Common Lisp macro expert. Given this code pattern:
(define-mustache-character #\/ (make-instance 'section-end-tag :text arg-text :start start))

Write a macro that addresses: Macro call that should be transformed by define

(define-mustache-character #\/ (make-instance 'section-end-tag :text arg-text :start start))

[Assistant]
(defmacro define (name template)
  "Define a named renderer of string TEMPLATE."
  `(setf (symbol-function ',name)
         (compile-template ,template)))

;; macroexpand:
(set-mustache-character #\SOLIDUS (lambda (raw-text arg-text escapep start end) (declare (ignorable raw-text arg-text escapep start end) (type simple-string raw-text arg-text) (boolean escapep) (offset start end)) (make-instance (quote section-end-tag) :text arg-text :start start)))


[User]
Generate a defmacro form that transforms code like this:
(f nil
  :key
  nil)

Pattern to recognize: Macro call that should be transformed by F

(f nil
  :key
  nil)

[Assistant]
(defmacro F ...)

;; macroexpand:
(lambda () :key nil)


[User]
Define a macro that eliminates this repetitive pattern:
(define-component js-minify :input-type "js" :output-type "min.js" :compile-function (lambda (input-pathname output-pathname) (inferior-shell:run `("yui-compressor" ,input-pathname "-o" ,output-pathname) :show t)))

Issue: Macro call that should be transformed by define-component

(define-component js-minify :input-type "js" :output-type "min.js" :compile-function (lambda (input-pathname output-pathname) (inferior-shell:run `("yui-compressor" ,input-pathname "-o" ,output-pathname) :show t)))

[Assistant]
(defmacro define-component (name &key input-type output-type compile-function)
  "Define an ASDF component."
  `(progn
     (defclass ,name (source-file)
       ((type :initform ,input-type)
        (output :reader output :initarg :output)))

     (defmethod perform ((o load-op) (component ,name)) t)

     (defmethod output-files ((operation compile-op) (component ,name))
       (list
        (output-pathname component ,output-type)))

     (defmethod perform ((o compile-op) (component ,name))
       (funcall ,compile-function
                (component-pathname component)
                (output-pathname component ,output-type)))

     (import ',name :asdf)))

;; macroexpand:
(progn (defclass js-minify (source-file) ((type :initform "js") (output :reader output :initarg :output))) (defmethod perform ((o load-op) (component js-minify)) t) (defmethod output-files ((operation compile-op) (component js-minify)) (list (output-pathname component "min.js"))) (defmethod perform ((o compile-op) (component js-minify)) (funcall (lambda (input-pathname output-pathname) (inferior-shell:run (sb-int:quasiquote ("yui-compressor" #S(sb-impl::comma :expr input-pathname :kind 0) "-o" #S(sb-impl::comma :expr output-pathname :kind 0))) :show t)) (component-pathname component) (output-pathname component "min.js"))) (import (quote js-minify) :asdf))


[User]
Generate a defmacro form that transforms code like this:
(defun-compile-time walk-multiple-value-prog1 (map-function reduce-function screamer? partial? nested? form environment) (unless (null (rest (last form))) (error "Improper MULTIPLE-VALUE-PROG1: ~S" form)) (unless (>= (length form) 2) (error "MULTIPLE-VALUE-PROG1 must have at least one argument, a FORM: ~S" form)) (if reduce-function (funcall reduce-function (funcall map-function form 'multiple-value-prog1) (reduce reduce-function (mapcar #'(lambda (subform) (walk map-function reduce-function screamer? partial? nested? subform environment)) (rest form)))) (funcall map-function form 'multiple-value-prog1)))

Pattern to recognize: Macro call that should be transformed by defun-compile-time

(defun-compile-time walk-multiple-value-prog1 (map-function reduce-function screamer? partial? nested? form environment) (unless (null (rest (last form))) (error "Improper MULTIPLE-VALUE-PROG1: ~S" form)) (unless (>= (length form) 2) (error "MULTIPLE-VALUE-PROG1 must have at least one argument, a FORM: ~S" form)) (if reduce-function (funcall reduce-function (funcall map-function form 'multiple-value-prog1) (reduce reduce-function (mapcar #'(lambda (subform) (walk map-function reduce-function screamer? partial? nested? subform environment)) (rest form)))) (funcall map-function form 'multiple-value-prog1)))

[Assistant]
(defmacro defun-compile-time (function-name lambda-list &body body)
  `(eval-when (:compile-toplevel :load-toplevel :execute)
     (cl:defun ,function-name ,lambda-list ,@body)
     (eval-when (:compile-toplevel) (compile ',function-name))))

;; macroexpand:
(eval-when (:compile-toplevel :load-toplevel :execute) (common-lisp:defun walk-multiple-value-prog1 (map-function reduce-function screamer? partial? nested? form environment) (unless (null (rest (last form))) (error "Improper MULTIPLE-VALUE-PROG1: ~S" form)) (unless (>= (length form) 2) (error "MULTIPLE-VALUE-PROG1 must have at least one argument, a FORM: ~S" form)) (if reduce-function (funcall reduce-function (funcall map-function form (quote multiple-value-prog1)) (reduce reduce-function (mapcar (function (lambda (subform) (walk map-function reduce-function screamer? partial? nested? subform environment))) (rest form)))) (funcall map-function form (quote multiple-value-prog1)))) (eval-when (:compile-toplevel) (compile (quote walk-multiple-value-prog1))))


[User]
Write a Common Lisp macro to handle this code pattern:
(with-open-temporary-file (f :keep keep) (pathname f))

Problem: Macro call that should be transformed by with-open-temporary-file

(with-open-temporary-file (f :keep keep) (pathname f))

[Assistant]
(defmacro with-open-temporary-file ((stream &rest args &key keep &allow-other-keys) &body body)
  "Create a temporary file using OPEN-TEMPORARY with ARGS and run BODY
  with STREAM bound to the temporary file stream.  Returns the values
  returned by BODY.  By default, the file is deleted when BODY is
  exited. If a true value is passed in KEEP, the file is not deleted
  when the body is exited.  See OPEN-TEMPORARY for more permitted
  options."
  `(with-open-stream (,stream (open-temporary ,@(alexandria:remove-from-plist args :keep)))
     #+sbcl
     (declare (sb-ext:muffle-conditions sb-ext:code-deletion-note))
     ,(if (and (constantp keep)
               keep)
          `(progn ,@body)
          `(unwind-protect
                (progn ,@body)
             (unless ,keep
               (close ,stream)
               (delete-file (pathname ,stream)))))))

;; macroexpand:
(with-open-stream (f (open-temporary)) (declare (sb-ext:muffle-conditions sb-ext:code-deletion-note)) (unwind-protect (progn (pathname f)) (unless keep (close f) (delete-file (pathname f)))))


[User]
Write a Common Lisp macro to handle this code pattern:
(defclause returning (&rest forms) "Returns each form in <forms> as the value of the do+ form when the loop ends. If multiple forms are specified, by one or more RETURNING clauses, multiple values are returned, in the order the corresponding forms appear lexically. If one of the <forms> is (cl:values ...), then each value will be returned as if the values were spelled as direct arguments of the RETURNING form." (let (result-clauses) (dolist (form forms) (if (and (listp form) (eq 'values (car form))) (dolist (form (cdr form)) (push (make-result :form form) result-clauses)) (push (make-result :form form) result-clauses))) (nreverse result-clauses)))

Problem: Macro call that should be transformed by defclause

(defclause returning (&rest forms) "Returns each form in <forms> as the value of the do+ form when the loop ends. If multiple forms are specified, by one or more RETURNING clauses, multiple values are returned, in the order the corresponding forms appear lexically. If one of the <forms> is (cl:values ...), then each value will be returned as if the values were spelled as direct arguments of the RETURNING form." (let (result-clauses) (dolist (form forms) (if (and (listp form) (eq 'values (car form))) (dolist (form (cdr form)) (push (make-result :form form) result-clauses)) (push (make-result :form form) result-clauses))) (nreverse result-clauses)))

[Assistant]
(defmacro defclause (name arglist &body body)
  "Same as cl:defmacro, but additionally records <name> in *clauses* as a known clause macro."
  `(progn
     (defmacro ,name ,arglist ,@body)
     (pushnew ',name *clauses*)))

;; macroexpand:
(progn (defmacro returning (&rest forms) "Returns each form in <forms> as the value of the do+ form when the loop ends. If multiple forms are specified, by one or more RETURNING clauses, multiple values are returned, in the order the corresponding forms appear lexically. If one of the <forms> is (cl:values ...), then each value will be returned as if the values were spelled as direct arguments of the RETURNING form." (let (result-clauses) (dolist (form forms) (if (and (listp form) (eq (quote values) (car form))) (dolist (form (cdr form)) (push (make-result :form form) result-clauses)) (push (make-result :form form) result-clauses))) (nreverse result-clauses))) (pushnew (quote returning) *clauses*))


[User]
Write a Common Lisp macro to handle this code pattern:
(next-in nil)

Problem: Macro call that should be transformed by NEXT-IN

(next-in nil)

[Assistant]
(defmacro NEXT-IN ...)

;; macroexpand:
(do-next-in nil #'(lambda ()))


[User]
Define a macro that eliminates this repetitive pattern:
(pop-last-preprocessor-directive-token directive-token-list directive-symbol)

Issue: Macro call that should be transformed by pop-last-preprocessor-directive-token

(pop-last-preprocessor-directive-token directive-token-list directive-symbol)

[Assistant]
(defmacro pop-last-preprocessor-directive-token (token-list directive-name)
  "For #ifdef, #ifndef, and #undef"
  (with-gensyms (dsym_)
    `(let ((,dsym_ ,directive-name))
       (prog1 (pop-preprocessor-directive-token ,token-list ,dsym_)
         (check-no-preprocessor-token ,token-list ,dsym_)))))

;; macroexpand:
(let ((#:dsym_269 directive-symbol)) (prog1 (pop-preprocessor-directive-token directive-token-list #:dsym_269) (check-no-preprocessor-token directive-token-list #:dsym_269)))


[User]
Write a Common Lisp macro to handle this code pattern:
(-> :heh () (funcall #'%continue))

Problem: Macro call that should be transformed by ->

(-> :heh () (funcall #'%continue))

[Assistant]
(defmacro -> (invariant &body args)
  "See flow:atomically"
  `(atomically ,invariant ,@args))

;; macroexpand:
(atomically :heh nil (funcall (function %continue)))


[User]
Define a macro that eliminates this repetitive pattern:
(defstruct*
  nil
  (progn))

Issue: Macro call that should be transformed by DEFSTRUCT*

(defstruct*
  nil
  (progn))

[Assistant]
(defmacro DEFSTRUCT* ...)

;; macroexpand:
(progn
 (defclass nil nil ((progn :initform nil :initarg :progn :accessor nil-progn)))
 (defun make-nil (&rest structure-ext.as-class::args)
   (apply #'make-instance 'nil structure-ext.as-class::args))
 (defgeneric copy-nil
     (structure-ext.as-class::arg))
 (defmethod copy-nil ((structure-ext.as-class::arg nil))
   (let ((structure-ext.as-class::obj
          (make-instance (class-of structure-ext.as-class::arg))))
     (dolist
         (structure-ext.as-class::slot
          (structure-ext.as-class::slots<=obj structure-ext.as-class::arg))
       (if (slot-boundp structure-ext.as-class::arg
                        structure-ext.as-class::slot)
           (setf (slot-value structure-ext.as-class::obj
                             structure-ext.as-class::slot)
                   (slot-value structure-ext.as-class::arg
                               structure-ext.as-class::slot))
           (slot-makunbound structure-ext.as-class::obj
                            structure-ext.as-class::slot)))
     structure-ext.as-class::obj))
 (defun nil-p (structure-ext.as-class::arg)
   (typep structure-ext.as-class::arg 'nil))
 'nil)


[User]
You are a Common Lisp macro expert. Given this code pattern:
(draw scene (:rect :x 30 :y 300 :width 400 :height 150) :fill "rgb(230,230,230)" :stroke "black")

Write a macro that addresses: Macro call that should be transformed by draw

(draw scene (:rect :x 30 :y 300 :width 400 :height 150) :fill "rgb(230,230,230)" :stroke "black")

[Assistant]
(defmacro draw (scene (shape &rest params) &rest opts)
  (let ((element (gensym)))
    `(let ((,element (funcall #'make-svg-element ,shape (append (list ,@params) (list ,@opts)))))
       (add-element ,scene ,element)
       ,element)))

;; macroexpand:
(let ((#:g165 (funcall (function make-svg-element) :rect (append (list :x 30 :y 300 :width 400 :height 150) (list :fill "rgb(230,230,230)" :stroke "black"))))) (add-element scene #:g165) #:g165)


[User]
You are a Common Lisp macro expert. Given this code pattern:
(builder (:session :store (make-dbi-store :connector (lambda () *conn*))) (lambda (env) (unless (gethash :counter (getf env :lack.session)) (setf (gethash :counter (getf env :lack.session)) 0)) `(200 (:content-type "text/plain") (,(format nil "Hello, you've been here for ~Ath times!" (incf (gethash :counter (getf env :lack.session))))))))

Write a macro that addresses: Macro call that should be transformed by builder

(builder (:session :store (make-dbi-store :connector (lambda () *conn*))) (lambda (env) (unless (gethash :counter (getf env :lack.session)) (setf (gethash :counter (getf env :lack.session)) 0)) `(200 (:content-type "text/plain") (,(format nil "Hello, you've been here for ~Ath times!" (incf (gethash :counter (getf env :lack.session))))))))

[Assistant]
(defmacro builder (&rest app-or-middlewares)
  (let ((middlewares (butlast app-or-middlewares)))
    `(reduce #'funcall
             (remove-if
              #'null
              (list
               ,@(loop for mw in middlewares
                       when mw
                         collect (convert-to-middleware-form mw))))
             :initial-value (to-app ,(car (last app-or-middlewares)))
             :from-end t)))

;; macroexpand:
(reduce (function funcall) (remove-if (function null) (list (lambda (#:app232) (funcall (find-middleware :session) #:app232 :store (make-dbi-store :connector (lambda nil *conn*)))))) :initial-value (to-app (lambda (env) (unless (gethash :counter (getf env :lack.session)) (setf (gethash :counter (getf env :lack.session)) 0)) (sb-int:quasiquote (200 (:content-type "text/plain") (#S(sb-impl::comma :expr (format nil "Hello, you've been here for ~Ath times!" (incf (gethash :counter (getf env :lack.session)))) :kind 0)))))) :from-end t)


[User]
Write a Common Lisp macro to handle this code pattern:
(next-in nil (progn))

Problem: Macro call that should be transformed by NEXT-IN

(next-in nil (progn))

[Assistant]
(defmacro NEXT-IN ...)

;; macroexpand:
(do-next-in nil #'(lambda () (progn)))


[User]
Generate a defmacro form that transforms code like this:
(define-custom-var (:string-scope *string-scope-variables*) nil "A list of symbols naming dynamic variables which should be re-bound in the scope of every JSON String.")

Pattern to recognize: Macro call that should be transformed by define-custom-var

(define-custom-var (:string-scope *string-scope-variables*) nil "A list of symbols naming dynamic variables which should be re-bound in the scope of every JSON String.")

[Assistant]
(defmacro define-custom-var ((key name) &rest other-args)
  `(eval-when (:compile-toplevel :load-toplevel :execute)
     (progn (pushnew '(,name . ,key) *custom-vars* :test #'equal)
            (defvar ,name ,@other-args))))

;; macroexpand:
(eval-when (:compile-toplevel :load-toplevel :execute) (progn (pushnew (quote (*string-scope-variables* . :string-scope)) *custom-vars* :test (function equal)) (defvar *string-scope-variables* nil "A list of symbols naming dynamic variables which should be re-bound in the scope of every JSON String.")))


[User]
Create a Common Lisp macro for the following transformation. Before code:
(asif (incf (car x)) it (list :oops it))

What needs to change: Macro call that should be transformed by asif

(asif (incf (car x)) it (list :oops it))

[Assistant]
(defmacro asif (test then &optional else)
  "Like IF, except binds the result of the test to IT (via LET) for
the the scope of the then-expression, and the test form to IT (via
SYMBOL-MACROLET) for the scope of the else-expression. Within scope of
the else-expression, IT can be set with SETF."
    `(let ((it ,test))
       (if it
	   ,then
	   (symbolic ignore-first ,test ,else))))

;; macroexpand:
(let ((it (incf (car x)))) (if it it (symbolic ignore-first (incf (car x)) (list :oops it))))


[User]
Create a Common Lisp macro for the following transformation. Before code:
(is (= 6 (length results)))

What needs to change: Macro call that should be transformed by is

(is (= 6 (length results)))

[Assistant]
(defmacro is (test &rest reason-args)
  "The DWIM checking operator.

If TEST returns a true value a test-passed result is generated,
otherwise a test-failure result is generated. The reason, unless
REASON-ARGS is provided, is generated based on the form of TEST:

 (predicate expected actual) - Means that we want to check
 whether, according to PREDICATE, the ACTUAL value is
 in fact what we EXPECTED.

 (predicate value) - Means that we want to ensure that VALUE
 satisfies PREDICATE.

 Wrapping the TEST form in a NOT simply produces a negated reason
 string."
  (assert (listp test)
          (test)
          "Argument to IS must be a list, not ~S" test)
  (let (bindings effective-test default-reason-args)
    (with-gensyms (e a v)
      (flet ((process-entry (predicate expected actual &optional negatedp)
               ;; make sure EXPECTED is holding the entry that starts with 'values
               (when (and (consp actual)
                          (eq (car actual) 'values))
                 (assert (not (and (consp expected)
                                   (eq (car expected) 'values))) ()
                                   "Both the expected and actual part is a values expression.")
                 (rotatef expected actual))
               (let ((setf-forms))
                 (if (and (consp expected)
                          (eq (car expected) 'values))
                     (progn
                       (setf expected (copy-list expected))
                       (setf setf-forms (loop for cell = (rest expected) then (cdr cell)
                                              for i from 0
                                              while cell
                                              when (eq (car cell) '*)
                                              collect `(setf (elt ,a ,i) nil)
                                              and do (setf (car cell) nil)))
                       (setf bindings (list (list e `(list ,@(rest expected)))
                                            (list a `(multiple-value-list ,actual)))))
                     (setf bindings (list (list e expected)
                                          (list a actual))))
                 (setf effective-test `(progn
                                         ,@setf-forms
                                         ,(if negatedp
                                              `(not (,predicate ,e ,a))
                                              `(,predicate ,e ,a)))))))
        (list-match-case test
          ((not (?predicate ?expected ?actual))
           (process-entry ?predicate ?expected ?actual t)
           (setf default-reason-args
                 (list "~2&~S~2% evaluated to ~2&~S~2% which is ~2&~S~2%to ~2&~S~2% (it should not be)"
                       `',?actual a `',?predicate e)))
          ((not (?satisfies ?value))
           (setf bindings (list (list v ?value))
                 effective-test `(not (,?satisfies ,v))
                 default-reason-args
                 (list "~2&~S~2% evaluated to ~2&~S~2% which satisfies ~2&~S~2% (it should not)"
                       `',?value v `',?satisfies)))
          ((?predicate ?expected ?actual)
           (process-entry ?predicate ?expected ?actual)
           (setf default-reason-args
                 (list "~2&~S~2% evaluated to ~2&~S~2% which is not ~2&~S~2% to ~2&~S~2%"
                       `',?actual a `',?predicate e)))
          ((?satisfies ?value)
           (setf bindings (list (list v ?value))
                 effective-test `(,?satisfies ,v)
                 default-reason-args
                 (list "~2&~S~2% evaluated to ~2&~S~2% which does not satisfy ~2&~S~2%"
                       `',?value v `',?satisfies)))
          (?_
           (setf bindings '()
                 effective-test test
                 default-reason-args (list "~2&~S~2% was NIL." `',test)))))
      `(let ,bindings
         (if ,effective-test
             (add-result 'test-passed :test-expr ',test)
             (process-failure ',test
                              ,@(or reason-args default-reason-args)))))))

;; macroexpand:
(let ((#:e202 6) (#:a203 (length results))) (if (progn (= #:e202 #:a203)) (add-result (quote test-passed) :test-expr (quote (= 6 (length results)))) (process-failure (quote (= 6 (length results))) "~2&~S~2% evaluated to ~2&~S~2% which is not ~2&~S~2% to ~2&~S~2%" (quote (length results)) #:a203 (quote =) #:e202)))


[User]
Write a Common Lisp macro to handle this code pattern:
(defcategory :critical)

Problem: Macro call that should be transformed by defcategory

(defcategory :critical)

[Assistant]
(defmacro defcategory (category &optional expands-as set)
  `(defcategory-fn ',category ',expands-as ,set))

;; macroexpand:
(defcategory-fn (quote :critical) (quote nil) nil)


[User]
Generate a defmacro form that transforms code like this:
(deferror "22007" invalid-datetime-format data-exception)

Pattern to recognize: Macro call that should be transformed by deferror

(deferror "22007" invalid-datetime-format data-exception)

[Assistant]
(defmacro deferror (code typename &optional (superclass 'database-error))
  `(progn (define-condition ,typename (,superclass) ())
          (setf (gethash ,code *error-table*) ',typename)))

;; macroexpand:
(progn (define-condition invalid-datetime-format (data-exception) nil) (setf (gethash "22007" *error-table*) (quote invalid-datetime-format)))


[User]
Generate a defmacro form that transforms code like this:
(when (first in-decl) (setf (first in-decl-item) nil))

Pattern to recognize: Macro call that should be transformed by when

(when (first in-decl) (setf (first in-decl-item) nil))

[Assistant]
(defmacro when (test &body forms)
  `(if ,test
	   ,(cl:if (cadr forms)
			   `(progn ,@forms)
			   (car forms))))

;; macroexpand:
(if (first in-decl) (setf (first in-decl-item) nil))


[User]
Write a Common Lisp macro to handle this code pattern:
(collect-or 'some-name)

Problem: Macro call that should be transformed by COLLECT-OR

(collect-or 'some-name)

[Assistant]
(defmacro COLLECT-OR ...)

;; macroexpand:
(common-lisp:let* ((#:generator-332 (generator 'some-name))
                   #:bools-328
                   (#:bool-329 nil))
  (declare (type generator #:generator-332))
  (tagbody
   #:ll-333
    (setq #:bools-328 (next-in #:generator-332 (go end)))
    (if (setq #:bool-329 #:bools-328)
        (go end))
    (go #:ll-333)
   end)
  #:bool-329)


[User]
Create a Common Lisp macro for the following transformation. Before code:
(lambda* nil
  (progn))

What needs to change: Macro call that should be transformed by LAMBDA*

(lambda* nil
  (progn))

[Assistant]
(defmacro LAMBDA* ...)

;; macroexpand:
(lambda ()
  (with-yield
    (progn)))


[User]
Write a Common Lisp macro to handle this code pattern:
(maybe-do-not-silence-errors (handler-case (call-next-method) (error (err) (warn "Unhandled error when evaluating ~a:~% ~a~%" (or (ignore-errors (format-result result :oneline)) result) err) (setf (description result) (format NIL "The test failed to evaluate properly:~% ~a" err)) (setf (status result) :failed))))

Problem: Macro call that should be transformed by maybe-do-not-silence-errors

(maybe-do-not-silence-errors (handler-case (call-next-method) (error (err) (warn "Unhandled error when evaluating ~a:~% ~a~%" (or (ignore-errors (format-result result :oneline)) result) err) (setf (description result) (format NIL "The test failed to evaluate properly:~% ~a" err)) (setf (status result) :failed))))

[Assistant]
(defmacro maybe-do-not-silence-errors (&body body)
  `(if *silence-plain-compilation-errors-p*
       ,@body
       (let ((ok nil))
         (unwind-protect
              (multiple-value-prog1
                  (call-next-method)
                (setf ok t))
           (unless ok (setf (status result) :failed))))))

;; macroexpand:
(if *silence-plain-compilation-errors-p* (handler-case (call-next-method) (error (err) (warn "Unhandled error when evaluating ~a:~% ~a~%" (or (ignore-errors (format-result result :oneline)) result) err) (setf (description result) (format nil "The test failed to evaluate properly:~% ~a" err)) (setf (status result) :failed))) (let ((ok nil)) (unwind-protect (multiple-value-prog1 (call-next-method) (setf ok t)) (unless ok (setf (status result) :failed)))))


[User]
You are a Common Lisp macro expert. Given this code pattern:
(terminate)

Write a macro that addresses: Macro call that should be transformed by TERMINATE

(terminate)

[Assistant]
(defmacro TERMINATE ...)

;; macroexpand:
(finish)


[User]
You are a Common Lisp macro expert. Given this code pattern:
(@ nil nil)

Write a macro that addresses: Macro call that should be transformed by @

(@ nil nil)

[Assistant]
(defmacro @ ...)

;; macroexpand:
(message-oo.mangle::nil nil)


[User]
Generate a defmacro form that transforms code like this:
(in-readtable nil)

Pattern to recognize: Macro call that should be transformed by IN-READTABLE

(in-readtable nil)

[Assistant]
(defmacro IN-READTABLE ...)

;; macroexpand:
(eval-when (:compile-toplevel :load-toplevel :execute)
  (setf *readtable* (ensure-readtable 'nil))
  (when (or (find-package :swank) (find-package :slynk))
    (editor-hints.named-readtables::%frob-swank-readtable-alist *package*
                                                                *readtable*))
  *readtable*)


[User]
Create a Common Lisp macro for the following transformation. Before code:
(define-op (:!= infix-op))

What needs to change: Macro call that should be transformed by define-op

(define-op (:!= infix-op))

[Assistant]
(defmacro define-op ((op-name struct-type &key sql-op-name include-slots (package (find-package '#:sxql/operator))) &body body)
  (check-type op-name symbol)
  (let ((struct-name (intern (concatenate 'string (symbol-name op-name) #.(string :-op)) package)))
    `(defstruct (,struct-name (:include ,struct-type
                               (name ,(or sql-op-name
                                          (with-output-to-string (s)
                                            (loop for c across (symbol-name op-name)
                                                  if (char= c #\-)
                                                    do (write-char #\Space s)
                                                  else
                                                    do (write-char c s)))))
                               ,@include-slots)
                              (:constructor ,(intern (concatenate 'string
                                                                  #.(string :make-)
                                                                  (symbol-name op-name)
                                                                  #.(string :-op))
                                                     package)
                                  ,(ecase struct-type
                                     ((unary-op
                                       unary-splicing-op
                                       unary-postfix-op) '(var))
                                     ((infix-op
                                       infix-splicing-op
                                       infix-list-op) '(left right))
                                     (conjunctive-op '(&rest expressions)))))
       ,@body)))

;; macroexpand:
(defstruct (!=-op (:include infix-op (name "!=")) (:constructor make-!=-op (left right))))


[User]
Write a Common Lisp macro to handle this code pattern:
(is-true (with-*test-dribble* nil (explain! (run 'is1))))

Problem: Macro call that should be transformed by is

(is-true (with-*test-dribble* nil (explain! (run 'is1))))

[Assistant]
(defmacro is (test &rest reason-args)
  "The DWIM checking operator.

If TEST returns a true value a test-passed result is generated,
otherwise a test-failure result is generated. The reason, unless
REASON-ARGS is provided, is generated based on the form of TEST:

 (predicate expected actual) - Means that we want to check
 whether, according to PREDICATE, the ACTUAL value is
 in fact what we EXPECTED.

 (predicate value) - Means that we want to ensure that VALUE
 satisfies PREDICATE.

 Wrapping the TEST form in a NOT simply produces a negated reason
 string."
  (assert (listp test)
          (test)
          "Argument to IS must be a list, not ~S" test)
  (let (bindings effective-test default-reason-args)
    (with-gensyms (e a v)
      (flet ((process-entry (predicate expected actual &optional negatedp)
               ;; make sure EXPECTED is holding the entry that starts with 'values
               (when (and (consp actual)
                          (eq (car actual) 'values))
                 (assert (not (and (consp expected)
                                   (eq (car expected) 'values))) ()
                                   "Both the expected and actual part is a values expression.")
                 (rotatef expected actual))
               (let ((setf-forms))
                 (if (and (consp expected)
                          (eq (car expected) 'values))
                     (progn
                       (setf expected (copy-list expected))
                       (setf setf-forms (loop for cell = (rest expected) then (cdr cell)
                                              for i from 0
                                              while cell
                                              when (eq (car cell) '*)
                                              collect `(setf (elt ,a ,i) nil)
                                              and do (setf (car cell) nil)))
                       (setf bindings (list (list e `(list ,@(rest expected)))
                                            (list a `(multiple-value-list ,actual)))))
                     (setf bindings (list (list e expected)
                                          (list a actual))))
                 (setf effective-test `(progn
                                         ,@setf-forms
                                         ,(if negatedp
                                              `(not (,predicate ,e ,a))
                                              `(,predicate ,e ,a)))))))
        (list-match-case test
          ((not (?predicate ?expected ?actual))
           (process-entry ?predicate ?expected ?actual t)
           (setf default-reason-args
                 (list "~2&~S~2% evaluated to ~2&~S~2% which is ~2&~S~2%to ~2&~S~2% (it should not be)"
                       `',?actual a `',?predicate e)))
          ((not (?satisfies ?value))
           (setf bindings (list (list v ?value))
                 effective-test `(not (,?satisfies ,v))
                 default-reason-args
                 (list "~2&~S~2% evaluated to ~2&~S~2% which satisfies ~2&~S~2% (it should not)"
                       `',?value v `',?satisfies)))
          ((?predicate ?expected ?actual)
           (process-entry ?predicate ?expected ?actual)
           (setf default-reason-args
                 (list "~2&~S~2% evaluated to ~2&~S~2% which is not ~2&~S~2% to ~2&~S~2%"
                       `',?actual a `',?predicate e)))
          ((?satisfies ?value)
           (setf bindings (list (list v ?value))
                 effective-test `(,?satisfies ,v)
                 default-reason-args
                 (list "~2&~S~2% evaluated to ~2&~S~2% which does not satisfy ~2&~S~2%"
                       `',?value v `',?satisfies)))
          (?_
           (setf bindings '()
                 effective-test test
                 default-reason-args (list "~2&~S~2% was NIL." `',test)))))
      `(let ,bindings
         (if ,effective-test
             (add-result 'test-passed :test-expr ',test)
             (process-failure ',test
                              ,@(or reason-args default-reason-args)))))))

;; macroexpand:
(if (with-*test-dribble* nil (explain! (run (quote is1)))) (add-result (quote test-passed) :test-expr (quote (with-*test-dribble* nil (explain! (run (quote is1)))))) (process-failure (quote (with-*test-dribble* nil (explain! (run (quote is1))))) "~S did not return a true value" (quote (with-*test-dribble* nil (explain! (run (quote is1)))))))


[User]
Write a Common Lisp macro to handle this code pattern:
(make-name-transformer nil)

Problem: Macro call that should be transformed by MAKE-NAME-TRANSFORMER

(make-name-transformer nil)

[Assistant]
(defmacro MAKE-NAME-TRANSFORMER ...)

;; macroexpand:
(lambda (name definition)
  (declare (ignorable definition))
  (concatenate-symbol nil))


[User]
Write a Common Lisp macro to handle this code pattern:
(defalias path:= (a b) cl-fad:pathname-equal)

Problem: Macro call that should be transformed by defalias

(defalias path:= (a b) cl-fad:pathname-equal)

[Assistant]
(defmacro defalias (name args realname)
  `(progn
     (defun ,name ,args
       ,(if (eql '&rest (first args))
            `(apply #',realname ,(second args))
            `(,realname ,@args)))
     (define-compiler-macro ,name (&rest args)
       (list* ',realname args))))

;; macroexpand:
(progn (defun path:= (a b) (pathname-equal a b)) (define-compiler-macro path:= (&rest args) (list* (quote pathname-equal) args)))


[User]
Define a macro that eliminates this repetitive pattern:
($ "$max" ($ "value-1" 610))

Issue: Macro call that should be transformed by $

($ "$max" ($ "value-1" 610))

[Assistant]
(defmacro $ (&rest args)
  `(kv ,@args))

;; macroexpand:
(kv "$max" ($ "value-1" 610))


[User]
You are a Common Lisp macro expert. Given this code pattern:
(def-neo4j-fun set-node-property (node-id property value) :put (:uri-spec (format nil "node/~A/properties/~A" node-id (if (symbolp property) (string-downcase (symbol-name property)) property))) (:encode value :string) (:status-handlers (204 (values t body)) (400 (error 'invalid-data-sent-error :uri uri :json json))))

Write a macro that addresses: Macro call that should be transformed by def-neo4j-fun

(def-neo4j-fun set-node-property (node-id property value) :put (:uri-spec (format nil "node/~A/properties/~A" node-id (if (symbolp property) (string-downcase (symbol-name property)) property))) (:encode value :string) (:status-handlers (204 (values t body)) (400 (error 'invalid-data-sent-error :uri uri :json json))))

[Assistant]
(defmacro def-neo4j-fun (name lambda-list method &rest args)
  `(progn
     (defun ,name (&key ,@lambda-list)
       (let ((uri ,(cadr (assoc :uri-spec args)))
             (json (encode-neo4j-json-payload ,@(aif (assoc :encode args)
                                                     (cdr it)
                                                     (list '() :string)))))
         (make-neo4j-request ,method uri json
                             (list ,@(mapcar (lambda (handler)
                                               `(list ,(car handler) (lambda (body uri json)
                                                                  ,(cadr handler))))
                                             (cdr (assoc :status-handlers args)))))))))

;; macroexpand:
(progn (defun set-node-property (&key node-id property value) (let ((uri (format nil "node/~A/properties/~A" node-id (if (symbolp property) (string-downcase (symbol-name property)) property))) (json (encode-neo4j-json-payload value :string))) (make-neo4j-request :put uri json (list (list 204 (lambda (body uri json) (values t body))) (list 400 (lambda (body uri json) (error (quote invalid-data-sent-error) :uri uri :json json))))))))


[User]
Write a Common Lisp macro to handle this code pattern:
(case-insensitive-mode-p flags)

Problem: Macro call that should be transformed by case-insensitive-mode-p

(case-insensitive-mode-p flags)

[Assistant]
(defmacro case-insensitive-mode-p (flags)
  "Accessor macro to extract the first flag out of a three-element flag list."
  `(first ,flags))

;; macroexpand:
(first flags)


[User]
Write a Common Lisp macro to handle this code pattern:
(check-cursor-attached cluffer:end-of-line (cursor))

Problem: Macro call that should be transformed by check-cursor-attached

(check-cursor-attached cluffer:end-of-line (cursor))

[Assistant]
(defmacro check-cursor-attached (name arguments)
  (let ((args (substitute '(cursor cluffer:cursor) 'cursor arguments)))
    `(defmethod ,name :before ,args
       (declare (ignore ,@(set-difference (remove 'cursor arguments)
                                          lambda-list-keywords)))
       (unless (cluffer:cursor-attached-p cursor)
         (error 'cluffer:cursor-detached)))))

;; macroexpand:
(defmethod cluffer:end-of-line :before ((cursor cluffer:cursor)) (declare (ignore)) (unless (cluffer:cursor-attached-p cursor) (error (quote cluffer:cursor-detached))))


[User]
Define a macro that eliminates this repetitive pattern:
(define-accumulation-binding collecting (var form &aux (head (cons NIL NIL)) (tail head)) (declare (type list var) (type cons head tail)) `(setf ,tail (setf (cdr ,tail) (cons ,form NIL)) ,var (cdr ,head)))

Issue: Macro call that should be transformed by define-accumulation-binding

(define-accumulation-binding collecting (var form &aux (head (cons NIL NIL)) (tail head)) (declare (type list var) (type cons head tail)) `(setf ,tail (setf (cdr ,tail) (cons ,form NIL)) ,var (cdr ,head)))

[Assistant]
(defmacro define-accumulation-binding (name (var &rest args) &body body)
  `(define-form-binding ,name (,var ,@args)
     ,@(form-fiddle:lambda-declarations `(lambda () ,@body))
     (values
      (progn ,@(form-fiddle:lambda-forms `(lambda () ,@body)))
      (delist var))))

;; macroexpand:
(define-form-binding collecting (var form &aux (head (cons nil nil)) (tail head)) (declare (type list var) (type cons head tail)) (values (progn (sb-int:quasiquote (setf #S(sb-impl::comma :expr tail :kind 0) (setf (cdr #S(sb-impl::comma :expr tail :kind 0)) (cons #S(sb-impl::comma :expr form :kind 0) nil)) #S(sb-impl::comma :expr var :kind 0) (cdr #S(sb-impl::comma :expr head :kind 0))))) (delist var)))


[User]
Define a macro that eliminates this repetitive pattern:
(do-generator-value-list (vals (apply #'multi-gen generators)) (yield (apply function (mapcar #'car vals))))

Issue: Macro call that should be transformed by do-generator

(do-generator-value-list (vals (apply #'multi-gen generators)) (yield (apply function (mapcar #'car vals))))

[Assistant]
(defmacro do-generator ((var &rest vars-and-generator) &body body)
  "Steps through the specified generator, binding the value it returns to var, then executing the body for each step. If multiple variables are specified and the generator returns multiple values, the extra values will be bound to the extra variables."
  (let ((g (gensym)))
    `(let ((,g ,(car (last vars-and-generator))))
       (loop
	  do (if-generator ((,var ,@(butlast vars-and-generator)) ,g)
			   (progn
			     ,@body)
			   (return))))))

;; macroexpand:
(let ((#:g165 (apply (function multi-gen) generators))) (loop do (if-generator (vals #:g165) (progn (yield (apply function (mapcar (function car) vals)))) (return))))


[User]
Generate a defmacro form that transforms code like this:
(with-reader-case nil
  nil)

Pattern to recognize: Macro call that should be transformed by WITH-READER-CASE

(with-reader-case nil
  nil)

[Assistant]
(defmacro WITH-READER-CASE ...)

;; macroexpand:
(let ()
  (let ((#:previous-case179 (readtable-case *readtable*)))
    (setf (readtable-case *readtable*) nil)
    (unwind-protect (progn nil)
      (setf (readtable-case *readtable*) #:previous-case179))))


[User]
Write a Common Lisp macro to handle this code pattern:
(when (not (gethash operatorXX name-map)))

Problem: Macro call that should be transformed by when

(when (not (gethash operatorXX name-map)))

[Assistant]
(defmacro when (test &body forms)
  `(if ,test
	   ,(cl:if (cadr forms)
			   `(progn ,@forms)
			   (car forms))))

;; macroexpand:
(if (not (gethash operatorxx name-map)) nil)


[User]
Define a macro that eliminates this repetitive pattern:
(match (list 1 2 3) (list x y z) (+ x y z))

Issue: Macro call that should be transformed by match

(match (list 1 2 3) (list x y z) (+ x y z))

[Assistant]
(defmacro match (arg &body clauses)
  "Matches ARG with CLAUSES. CLAUSES is a list of the form of (PATTERN
. BODY) where PATTERN is a pattern specifier and BODY is an implicit
progn. If ARG matches some PATTERN, `match` then evaluates
the corresponding BODY and returns the evaluated value.  If no pattern matches,
then returns NIL.

Evaluating a form (FAIL) in the clause body causes the latest pattern
matching to fail. For example,

    (match 1
      (x (if (eql x 1)
             (fail)
             x))
      (_ 'ok))

returns OK, because the form (FAIL) in the first clause is
evaluated.

If BODY starts with the symbols WHEN or UNLESS, then the next form
will be used to introduce (FAIL). That is,

    (match list ((list x) when (oddp x) x))
    (match list ((list x) unless (evenp x) x))

will be translated to

    (match list ((list x) (if (oddp x) x (fail))))
    (match list ((list x) (if (evenp x) (fail) x)))

Examples:

    (match 1 (1 1))
    => 1
    (match 1 (2 2))
    => 2
    (match 1 (x x))
    => 1
    (match (list 1 2 3)
      (list x y z) (+ x y z))
    => 6"
  (compile-match-1 arg clauses nil))

;; macroexpand:
(let ((#:var151 (list 1 2 3))) (declare (ignorable #:var151)) (%or (%or (let ((list #:var151)) x y z) (let ((+ #:var151)) x y z) (fail)) nil))


[User]
You are a Common Lisp macro expert. Given this code pattern:
(define-element-maker :use "use" '(:xlink-href))

Write a macro that addresses: Macro call that should be transformed by define-element-maker

(define-element-maker :use "use" '(:xlink-href))

[Assistant]
(defmacro define-element-maker (element name required-attributes)
  `(progn
     (defmethod assert-required-attributes ((element (eql ,element)) attributes)
       (declare (ignore element))
       (unless (evenp (length attributes))
         (warn "attribute list may be missing data: ~A" attributes))
       (let ((missing (set-difference ,required-attributes attributes)))
	 (when missing
	   (error 'missing-attributes :message (format nil "~A missing attributes: ~{~A~^ ~}" ,element missing)))))
     (defmethod make-svg-element ((element (eql ,element)) attributes)
       (when *check-required-attributes*
         (assert-required-attributes element attributes))
       (make-instance 'svg-element :name ,name :attributes attributes))))

;; macroexpand:
(progn (defmethod assert-required-attributes ((element (eql :use)) attributes) (declare (ignore element)) (unless (evenp (length attributes)) (warn "attribute list may be missing data: ~A" attributes)) (let ((missing (set-difference (quote (:xlink-href)) attributes))) (when missing (error (quote missing-attributes) :message (format nil "~A missing attributes: ~{~A~^ ~}" :use missing))))) (defmethod make-svg-element ((element (eql :use)) attributes) (when *check-required-attributes* (assert-required-attributes element attributes)) (make-instance (quote svg-element) :name "use" :attributes attributes)))


[User]
Generate a defmacro form that transforms code like this:
(match 1 (x x))

Pattern to recognize: Macro call that should be transformed by match

(match 1 (x x))

[Assistant]
(defmacro match (arg &body clauses)
  "Matches ARG with CLAUSES. CLAUSES is a list of the form of (PATTERN
. BODY) where PATTERN is a pattern specifier and BODY is an implicit
progn. If ARG matches some PATTERN, `match` then evaluates
the corresponding BODY and returns the evaluated value.  If no pattern matches,
then returns NIL.

Evaluating a form (FAIL) in the clause body causes the latest pattern
matching to fail. For example,

    (match 1
      (x (if (eql x 1)
             (fail)
             x))
      (_ 'ok))

returns OK, because the form (FAIL) in the first clause is
evaluated.

If BODY starts with the symbols WHEN or UNLESS, then the next form
will be used to introduce (FAIL). That is,

    (match list ((list x) when (oddp x) x))
    (match list ((list x) unless (evenp x) x))

will be translated to

    (match list ((list x) (if (oddp x) x (fail))))
    (match list ((list x) (if (evenp x) (fail) x)))

Examples:

    (match 1 (1 1))
    => 1
    (match 1 (2 2))
    => 2
    (match 1 (x x))
    => 1
    (match (list 1 2 3)
      (list x y z) (+ x y z))
    => 6"
  (compile-match-1 arg clauses nil))

;; macroexpand:
(let ((#:var150 1)) (declare (ignorable #:var150)) (%or (%or (let ((x #:var150)) x) (fail)) nil))


[User]
Define a macro that eliminates this repetitive pattern:
(-<>>)

Issue: Macro call that should be transformed by -<>>

(-<>>)

[Assistant]
(defmacro -<>> ...)

;; macroexpand:
nil