Instruction:
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

Input: (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))))

Output:
(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)))))))))

(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))))))))


Instruction:
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

Input: (case-insensitive-mode-p flags)

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


Instruction:
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

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

Output:
(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)))))

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


Instruction:
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

Input: (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)))

Output:
(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))))

(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)))


Instruction:
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

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

Output:
(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))))))

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


Instruction:
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

Input:
(with-reader-case nil
  nil)

Output: (defmacro WITH-READER-CASE ...)

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


Instruction:
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

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

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

(if (not (gethash operatorxx name-map)) nil)


Instruction:
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

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

Output:
(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))

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


Instruction:
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

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

Output:
(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))))

(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)))


Instruction:
Generate a defmacro form that transforms code like this:
(match 1 (x x))

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

Input: (match 1 (x x))

Output:
(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))

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


Instruction:
Define a macro that eliminates this repetitive pattern:
(-<>>)

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

Output: (defmacro -<>> ...)