Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(string-ecase 'lol-gen::some-name)

What needs to change: Macro call that should be transformed by STRING-ECASE

Input: (string-ecase 'lol-gen::some-name)

Output: (defmacro STRING-ECASE ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(lret* nil
  (progn))

Problem: Macro call that should be transformed by LRET*

Input:
(lret* nil
  (progn))

Output:
(defmacro lret* ((&rest bindings) &body body)
  "Cf. `lret'."
  `(lret-aux let* ,bindings
     ,@body))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(export-constructors
  common-lisp:nil
  common-lisp:nil)

Write a macro that addresses: Macro call that should be transformed by EXPORT-CONSTRUCTORS

Input:
(export-constructors
  common-lisp:nil
  common-lisp:nil)

Output: (defmacro EXPORT-CONSTRUCTORS ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(do-generators nil
  :key
  nil)

What needs to change: Macro call that should be transformed by DO-GENERATORS

Input:
(do-generators nil
  :key
  nil)

Output:
(defmacro do-generators (genspecs &body body)
  "Simultaneously iterate through multiple generators at once. By default
do-generators terminates when the shortest generator ends, but individual
generators can be padded out with the :fill-value keyword. Do-generators can
also iterate over lists in parallel with generators. To use lists, start the genspec with the :list keyword. Eg:
  (do-generators ((a (repeat 2))
			 (:list b '(4 5 6))
			 (c (list->generator '(8 9)) :fill-value 30))
	   (print (* a (+ b c))))
24
28
72
NIL"
  (let ((genspecs (mapcar #'proc-list-spec genspecs))
	(genr (gensym))
	(data (gensym))
	(sig (gensym)))
    (multiple-value-bind (varnames specs)
	(process-genspecs genspecs)

      `(let ((,genr (multi-gen ,@specs)))
	 (loop do
	   (destructuring-bind (,sig . ,data)
	       (multiple-value-list (next-generator-value ,genr))
	     (unless ,sig
	       (return))
	     ,(bind-clause data varnames body)))))))


Instruction:
Define a macro that eliminates this repetitive pattern:
(select-dao nil)

Issue: Macro call that should be transformed by SELECT-DAO

Input: (select-dao nil)

Output:
(defmacro select-dao (class &body clauses)
  "Build custom queries with SxQL.

Example:

  (select-dao 'tweet
    (where (:like :status \"%Japan%\")))

You can use \"includes\" to eagerly load another table and prevent the \"N+1 query\" performance problem:

  (select-dao 'tweet
    (includes 'user)
    (where (:like :status \"%Japan%\")))

You can use \"joins\" to add JOIN clauses for filtering by related table columns.
Note: \"joins\" does NOT automatically load foreign objects. Use \"includes\" if you need the ghost slots populated:

  ;; Filter by related table - ghost slot NOT populated
  (select-dao 'blog
    (joins 'user)
    (where (:= :user.status \"active\")))

  ;; Filter AND load foreign objects
  (select-dao 'blog
    (joins 'user)
    (includes 'user)
    (where (:= :user.status \"active\")))

See the SxQL documentation for the available clauses and operators."
  (with-gensyms (sql clause results include-classes foreign-class)
    (once-only (class)
      `(#+sb-package-locks locally #+sb-package-locks (declare (sb-ext:disable-package-locks sxql:where))
        #-sb-package-locks cl-package-locks:with-packages-unlocked #-sb-package-locks (sxql)
        (progn
          (setf ,class (ensure-class ,class))
          (let* ((sxql:*sql-symbol-conversion* #'unlispify)
                 (,sql
                   (sxql:select :*
                                (sxql:from (sxql:make-sql-symbol (table-name ,class)))))
                 (,include-classes '()))
            (macrolet ((where (expression)
                         `(sxql:make-clause :where ,(expand-op expression ',class))))
              ;; ignore compiler-note when includes is not used
              #+sbcl (declare (sb-ext:muffle-conditions sb-ext:code-deletion-note))
              (flet ((includes (&rest classes)
                       (appendf ,include-classes (mapcar #'ensure-class classes))
                       nil)
                     (joins (foreign-class &key (type :inner))
                       (let ((foreign-class (ensure-class foreign-class)))
                         (add-child ,sql
                                   (ecase type
                                     (:inner (sxql:inner-join
                                               (sxql:make-sql-symbol (table-name foreign-class))
                                               :on (make-join-condition ,class foreign-class)))
                                     (:left (sxql:left-join
                                              (sxql:make-sql-symbol (table-name foreign-class))
                                              :on (make-join-condition ,class foreign-class)))))
                         nil)))
                (dolist (,clause (list ,@clauses))
                  (when ,clause
                    (add-child ,sql ,clause)))
                (let ((,results (select-by-sql ,class ,sql)))
                  (unless *want-cursor*
                    (dolist (,foreign-class (remove-duplicates ,include-classes))
                      (include-foreign-objects ,foreign-class ,results)))
                  (values ,results ,sql))))))))))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(defconstant nil :key nil)

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

Input: (defconstant nil :key nil)

Output: (defmacro DEFCONSTANT ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(f_%
  nil
  nil)

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

Input:
(f_%
  nil
  nil)

Output: (defmacro F_% ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(vect-of 'lol-gen::some-name)

Issue: Macro call that should be transformed by VECT-OF

Input: (vect-of 'lol-gen::some-name)

Output: (defmacro VECT-OF ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(notinline 'lol-gen::some-name)

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

Input: (notinline 'lol-gen::some-name)

Output: (defmacro NOTINLINE ...)


Instruction:
Generate a defmacro form that transforms code like this:
(atypecase nil
  nil)

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

Input:
(atypecase nil
  nil)

Output:
(defmacro atypecase (keyform &body cases)
  "Like TYPECASE, except binds the result of the keyform to IT (via LET) for
the scope of the cases."
  `(anaphoric typecase ,keyform ,@cases))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(special)

Problem: Macro call that should be transformed by SPECIAL

Input: (special)

Output: (defmacro SPECIAL ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(shift-decf nil nil)

Issue: Macro call that should be transformed by SHIFT-DECF

Input: (shift-decf nil nil)

Output: (defmacro SHIFT-DECF ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(->*
  'lol-gen::some-name)

Write a macro that addresses: Macro call that should be transformed by ->*

Input:
(->*
  'lol-gen::some-name)

Output: (defmacro ->* ...)


Instruction:
Generate a defmacro form that transforms code like this:
(c?
  nil
  nil)

Pattern to recognize: Macro call that should be transformed by C?

Input:
(c?
  nil
  nil)

Output:
(defmacro c? (&body body)
  `(make-c-dependent
    :code ',body
    :value-state :unevaluated
    :rule (c-lambda ,@body)))


Instruction:
Define a macro that eliminates this repetitive pattern:
(with-standard-input-syntax
  nil
  (progn))

Issue: Macro call that should be transformed by WITH-STANDARD-INPUT-SYNTAX

Input:
(with-standard-input-syntax
  nil
  (progn))

Output:
(defmacro with-standard-input-syntax (&body body)
  "Like `with-standard-io-syntax', but only bind the variables that
control the reader, not the printer.

This may be preferable to using `with-standard-io-syntax' when loading
data, as it will not effect how errors are printed, thus preserving
debugging information."
  (with-thunk ((body :name with-standard-input-syntax))
    `(call/standard-input-syntax ,body)))


Instruction:
Define a macro that eliminates this repetitive pattern:
(is-condition nil nil)

Issue: Macro call that should be transformed by IS-CONDITION

Input: (is-condition nil nil)

Output:
(defmacro is-condition (form condition &optional desc)
  (with-gensyms (error duration)
    `(with-duration ((,duration ,error) (handler-case ,form
                                          (condition (,error) ,error)))
       (test ,error
             ,(if (and (listp condition) (eq 'quote (car condition)))
                  condition
                  `(quote ,condition))
             ,desc
             :duration ,duration
             :got-form ',form
             :test-fn #'typep
             :report-expected-label "raise a condition"))))


Instruction:
Generate a defmacro form that transforms code like this:
(collect-min nil (progn))

Pattern to recognize: Macro call that should be transformed by COLLECT-MIN

Input: (collect-min nil (progn))

Output: (defmacro COLLECT-MIN ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(either)

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

Input: (either)

Output: (defmacro EITHER ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(collect-first 'lol-gen::some-name)

What needs to change: Macro call that should be transformed by COLLECT-FIRST

Input: (collect-first 'lol-gen::some-name)

Output: (defmacro COLLECT-FIRST ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(ignore-errors 'lol-gen::some-name)

What needs to change: Macro call that should be transformed by IGNORE-ERRORS

Input: (ignore-errors 'lol-gen::some-name)

Output: (defmacro IGNORE-ERRORS ...)


Instruction:
Generate a defmacro form that transforms code like this:
(finish 'lol-gen::some-name)

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

Input: (finish 'lol-gen::some-name)

Output:
(defmacro finish (form &optional description &rest format-args)
  `(eval-in-context
    *context*
    (make-instance 'finishing-result
                   :expression '(finish ,form)
                   :body (lambda () ,form)
                   ,@(when description
                       `(:description (format NIL ,description ,@format-args))))))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(iterate nil)

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

Input: (iterate nil)

Output: (defmacro ITERATE ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(define-metadata-kind nil
    nil)

Issue: Macro call that should be transformed by DEFINE-METADATA-KIND

Input:
(define-metadata-kind nil
    nil)

Output:
(defmacro define-metadata-kind (name (&key conc-name (binds-to :value))
                             &body slot-names)
  (check-metadata-slots slot-names)
  (let ((type (ecase binds-to
                (:value 'standard-value-metadata)
                (:scope 'standard-scope-metadata))))
    `(progn
       (eval-when (:compile-toplevel :load-toplevel :execute)
         (defclass ,name (,type)
           ,(mapcar λ`(,_ :initform nil :initarg ,(kwd _))
                    slot-names)))
       ,@(mapcar λ`(defgeneric ,(if conc-name (symb conc-name _) _) (metadata))
                 slot-names)
       ,@(mapcar λ`(defmethod ,(if conc-name (symb conc-name _) _)
                       ((metadata-collection list))
                     (let ((data (cdr (assoc ',name metadata-collection))))
                       (when data
                         (slot-value data ',_))))
                 slot-names)
       ,@(mapcar λ`(defmethod ,(if conc-name (symb conc-name _) _)
                       ((metadata ,name))
                     (slot-value metadata ',_))
                 slot-names)
       ,(when slot-names (gen-meta-init-check name slot-names))
       (defmethod print-object ((obj ,name) stream)
         (print-unreadable-object (obj stream :type t :identity t)
           (with-slots ,slot-names obj
             (format stream ,(format nil "~{:~a ~~a~^ ~}" slot-names)
                     ,@slot-names))))
       (pushnew ',name *metadata-kinds*))))


Instruction:
Define a macro that eliminates this repetitive pattern:
(ecase-let 'lol-gen::some-name)

Issue: Macro call that should be transformed by ECASE-LET

Input: (ecase-let 'lol-gen::some-name)

Output:
(defmacro ecase-let ((var expr) &body cases)
  "Like (let ((VAR EXPR)) (ecase VAR ...)), with VAR read-only."
  `(let1 ,var ,expr
     (ecase ,var
       ,@cases)))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(all 'lol-gen::some-name)

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

Input: (all 'lol-gen::some-name)

Output:
(defmacro all (parser &rest parsers)
  "Combination of parsers yielding all results as a list."
  `(<*> ,parser ,@parsers))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(notinline common-lisp:nil
  :key
  common-lisp:nil)

Problem: Macro call that should be transformed by NOTINLINE

Input:
(notinline common-lisp:nil
  :key
  common-lisp:nil)

Output: (defmacro NOTINLINE ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(skip-on nil
    (progn))

Issue: Macro call that should be transformed by SKIP-ON

Input:
(skip-on nil
    (progn))

Output:
(defmacro skip-on (features desc &body tests)
  (let ((thunk (gensym "THUNK")))
    `(flet ((,thunk ()
              ,@tests))
       (if (featurep '(or ,@features))
           (with-forced-status (:skipped ,@(if (listp desc) desc (list desc)))
             (,thunk))
           (,thunk)))))


Instruction:
Generate a defmacro form that transforms code like this:
(prog () (progn))

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

Input: (prog () (progn))

Output: (defmacro PROG ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(psib nil)

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

Input: (psib nil)

Output:
(defmacro psib (&optional (self-form 'self))
  (let ((self (gensym)))
    `(bwhen (,self ,self-form)
        (find-prior ,self (kids (fm-parent ,self))))))


Instruction:
Generate a defmacro form that transforms code like this:
(nconcf nil nil)

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

Input: (nconcf nil nil)

Output: (defmacro NCONCF ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(appending 'lol-gen::some-name)

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

Input: (appending 'lol-gen::some-name)

Output: (defmacro APPENDING ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(rotatef nil)

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

Input: (rotatef nil)

Output: (defmacro ROTATEF ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(ematch common-lisp:nil
  (common-lisp:progn))

Problem: Macro call that should be transformed by EMATCH

Input:
(ematch common-lisp:nil
  (common-lisp:progn))

Output:
(defmacro ematch (what &body clauses)
  #.+match-doc+
  (with-gensyms (otherwise)
    `(match2 ,what
       ,@clauses
       (,otherwise (error 'match-error :pattern ',clauses :values (list ,otherwise))))))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(with-html-string
  nil)

Problem: Macro call that should be transformed by WITH-HTML-STRING

Input:
(with-html-string
  nil)

Output:
(defmacro with-html-string (&body body)
  "Like WITH-HTML, but capture the output as a string."
  `(with-output-to-string (*html*)
     (with-html ,@body)))


Instruction:
Define a macro that eliminates this repetitive pattern:
(check-declaration-env 'lol-gen::some-name)

Issue: Macro call that should be transformed by CHECK-DECLARATION-ENV

Input: (check-declaration-env 'lol-gen::some-name)

Output: (defmacro CHECK-DECLARATION-ENV ...)


Instruction:
Generate a defmacro form that transforms code like this:
(c?_
  'lol-gen::some-name)

Pattern to recognize: Macro call that should be transformed by C?_

Input:
(c?_
  'lol-gen::some-name)

Output:
(defmacro c?_ (&body body)
  `(make-c-dependent
    :code ',body
    :value-state :unevaluated
    :lazy t
    :rule (c-lambda ,@body)))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(defun-cmatch* common-lisp:nil
    (common-lisp:progn))

Write a macro that addresses: Macro call that should be transformed by DEFUN-CMATCH*

Input:
(defun-cmatch* common-lisp:nil
    (common-lisp:progn))

Output:
(defmacro defun-cmatch* (name args &body body)
  "Equivalent to (defun (arg) [decl-and-docstring] (cmatch arg (PATTERN BODY...)))."
  (multiple-value-bind (preamble clauses) (parse-matcher-body body)
    `(defun ,name ,args
       ,@preamble
       (cmatch* ,args
         ,@clauses))))


Instruction:
Generate a defmacro form that transforms code like this:
(aprog1 nil
  :key
  nil)

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

Input:
(aprog1 nil
  :key
  nil)

Output:
(defmacro aprog1 (first &body rest)
  "Binds IT to the first form so that it can be used in the rest of the
forms. The whole thing returns IT."
  `(anaphoric prog1 ,first ,@rest))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(is-values nil nil)

Write a macro that addresses: Macro call that should be transformed by IS-VALUES

Input: (is-values nil nil)

Output:
(defmacro is-values (got expected &rest args)
  `(is (multiple-value-list ,got) ,expected ,@args))


Instruction:
Define a macro that eliminates this repetitive pattern:
(declare-deprecated-operators 'lol-gen::some-name)

Issue: Macro call that should be transformed by DECLARE-DEPRECATED-OPERATORS

Input: (declare-deprecated-operators 'lol-gen::some-name)

Output: (defmacro DECLARE-DEPRECATED-OPERATORS ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(enable-static-dispatch)

What needs to change: Macro call that should be transformed by ENABLE-STATIC-DISPATCH

Input: (enable-static-dispatch)

Output: (defmacro ENABLE-STATIC-DISPATCH ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(pushnew nil (progn))

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

Input: (pushnew nil (progn))

Output: (defmacro PUSHNEW ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(decf nil)

Issue: Macro call that should be transformed by DECF

Input: (decf nil)

Output: (defmacro DECF ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(shift-incf nil)

Write a macro that addresses: Macro call that should be transformed by SHIFT-INCF

Input: (shift-incf nil)

Output: (defmacro SHIFT-INCF ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(unless nil (progn))

Issue: Macro call that should be transformed by UNLESS

Input: (unless nil (progn))

Output: (defmacro UNLESS ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(eval-when-compile
  common-lisp:nil
  (common-lisp:progn))

Problem: Macro call that should be transformed by EVAL-WHEN-COMPILE

Input:
(eval-when-compile
  common-lisp:nil
  (common-lisp:progn))

Output: (defmacro EVAL-WHEN-COMPILE ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(some-<> nil (progn))

What needs to change: Macro call that should be transformed by SOME-<>

Input: (some-<> nil (progn))

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


Instruction:
Write a Common Lisp macro to handle this code pattern:
(fgather-result 'lol-gen::some-name)

Problem: Macro call that should be transformed by FGATHER-RESULT

Input: (fgather-result 'lol-gen::some-name)

Output: (defmacro FGATHER-RESULT ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(defparameter* nil nil)

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

Input: (defparameter* nil nil)

Output: (defmacro DEFPARAMETER* ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(fail nil :key nil)

Problem: Macro call that should be transformed by FAIL

Input: (fail nil :key nil)

Output:
(defmacro fail (form &optional (type 'error) description &rest format-args)
  `(eval-in-context
    *context*
    (make-instance 'comparison-result
                   :expression '(fail ,form ,type)
                   :value-form '(capture-error ,form)
                   :body (lambda () (capture-error ,form ,(maybe-unquote type)))
                   :expected ',(maybe-unquote type)
                   :comparison 'typep
                   ,@(when description
                       `(:description (format NIL ,description ,@format-args))))))


Instruction:
Generate a defmacro form that transforms code like this:
(in-compile-time nil
  nil)

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

Input:
(in-compile-time nil
  nil)

Output: (defmacro IN-COMPILE-TIME ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(print-values
  'lol-gen::some-name)

Write a macro that addresses: Macro call that should be transformed by PRINT-VALUES

Input:
(print-values
  'lol-gen::some-name)

Output: (defmacro PRINT-VALUES ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(either
  nil
  nil)

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

Input:
(either
  nil
  nil)

Output: (defmacro EITHER ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(lambda () nil)

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

Input: (lambda () nil)

Output: (defmacro LAMBDA ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
;; Anonymous recursion requires explicit labels every time
(labels ((self (n)
           (if (> n 0)
             (cons n (self (- n 1)))
             nil)))
  #'self)

;; labels boilerplate obscures the recursive logic

What needs to change: Need anonymous recursion without writing labels boilerplate — want implicit 'self' for recursion

Input:
;; Anonymous recursion requires explicit labels every time
(labels ((self (n)
           (if (> n 0)
             (cons n (self (- n 1)))
             nil)))
  #'self)

;; labels boilerplate obscures the recursive logic

Output:
(defmacro alambda (parms &body body)
  `(labels ((self ,parms ,@body))
     #'self))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(initially nil :key nil)

Problem: Macro call that should be transformed by INITIALLY

Input: (initially nil :key nil)

Output: (defmacro INITIALLY ...)


Instruction:
Generate a defmacro form that transforms code like this:
(vect-of nil)

Pattern to recognize: Macro call that should be transformed by VECT-OF

Input: (vect-of nil)

Output: (defmacro VECT-OF ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(with-shuffling
  nil
  (progn))

What needs to change: Macro call that should be transformed by WITH-SHUFFLING

Input:
(with-shuffling
  nil
  (progn))

Output:
(defmacro with-shuffling (&body body)
  (let ((thunk (gensym "THUNK")))
    `(dolist (,thunk (shuffle
                      (list ,@(loop for form in body
                                    collect `(lambda () ,form)))))
       (funcall ,thunk))))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(c_1
  nil
  (progn))

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

Input:
(c_1
  nil
  (progn))

Output:
(defmacro c_1 (&body body)
  `(make-c-dependent
    :code '(without-c-dependency ,@body)
    :inputp nil
    :lazy t
    :value-state :unevaluated
    :rule (c-lambda (without-c-dependency ,@body))))


Instruction:
Generate a defmacro form that transforms code like this:
(with-symbol-access)

Pattern to recognize: Macro call that should be transformed by WITH-SYMBOL-ACCESS

Input: (with-symbol-access)

Output: (defmacro WITH-SYMBOL-ACCESS ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(-<>> 'lol-gen::some-name)

Write a macro that addresses: Macro call that should be transformed by -<>>

Input: (-<>> 'lol-gen::some-name)

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


Instruction:
Define a macro that eliminates this repetitive pattern:
(shrinkf nil nil)

Issue: Macro call that should be transformed by SHRINKF

Input: (shrinkf nil nil)

Output: (defmacro SHRINKF ...)


Instruction:
Generate a defmacro form that transforms code like this:
(.> 'lol-gen::some-name)

Pattern to recognize: Macro call that should be transformed by .>

Input: (.> 'lol-gen::some-name)

Output:
(defmacro .> (cl:&rest items)
  "Left associative compose operator. Creates a new functions that will run the
functions left to right when applied. This is the same as the `pipe` macro without supplying
the value. The composition is thus the reverse order of `compose`.

`(.> f g h)` creates the function `(fn (x) (h (g (f x))))`."
  (alexandria:with-gensyms (x)
    `(fn (,x)
       (pipe ,x ,@items))))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(sum-of nil)

Problem: Macro call that should be transformed by SUM-OF

Input: (sum-of nil)

Output: (defmacro SUM-OF ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(gen-lambda-with-sticky-stop nil nil)

Write a macro that addresses: Macro call that should be transformed by GEN-LAMBDA-WITH-STICKY-STOP

Input: (gen-lambda-with-sticky-stop nil nil)

Output:
(defmacro gen-lambda-with-sticky-stop (&rest rest)
  `(make-instance
    'basic-generator
    :function (sticky-stop-lambda ,@rest)))


Instruction:
Define a macro that eliminates this repetitive pattern:
(ensure-get nil
    :key
  nil)

Issue: Macro call that should be transformed by ENSURE-GET

Input:
(ensure-get nil
    :key
  nil)

Output:
(defmacro! ensure-get (o!key o!map &body (&optional default))
  `(multiple-value-bind (,g!value ,g!in-map?) (get ,g!key ,g!map)
     (if ,g!in-map?
	 (values ,g!value t)
	 (values
	  (setf (get ,g!key ,g!map) ,default)
	  nil))))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(inext nil)

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

Input: (inext nil)

Output: (defmacro INEXT ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(html nil nil)

Issue: Macro call that should be transformed by HTML

Input: (html nil nil)

Output:
(defmacro html (&rest tags)
  `(with-doctype :html
     (tag->string (cons :html ',tags))))


Instruction:
Define a macro that eliminates this repetitive pattern:
($slot nil)

Issue: Macro call that should be transformed by $SLOT

Input: ($slot nil)

Output: (defmacro $SLOT ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(with-connection nil
  nil)

Write a macro that addresses: Macro call that should be transformed by WITH-CONNECTION

Input:
(with-connection nil
  nil)

Output:
(defmacro with-connection (spec &body body)
  "Evaluates the body with *database* bound to a connection as specified by spec,
which should be list that connect can be applied to."
  `(let ((*database* (apply #'connect ,spec)))
     (unwind-protect (progn ,@body)
       (disconnect *database*))))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(notinline common-lisp:nil
  (common-lisp:progn))

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

Input:
(notinline common-lisp:nil
  (common-lisp:progn))

Output: (defmacro NOTINLINE ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(js nil :key nil)

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

Input: (js nil :key nil)

Output: (defmacro JS ...)


Instruction:
Generate a defmacro form that transforms code like this:
(destructuring-ccase-of nil
    nil)

Pattern to recognize: Macro call that should be transformed by DESTRUCTURING-CCASE-OF

Input:
(destructuring-ccase-of nil
    nil)

Output:
(defmacro destructuring-ccase-of (type keyplace &body body)
  "Like `destructuring-case-of', but providing a `store-value' restart
to collect KEYPLACE and try again."
  (expand-destructuring-case-of type keyplace body 'ccase-of))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(fm-otherx 'lol-gen::some-name)

What needs to change: Macro call that should be transformed by FM-OTHERX

Input: (fm-otherx 'lol-gen::some-name)

Output:
(defmacro fm-otherx (md-name &key (starting 'self) skip-tree)
   (if (eql starting 'self)
      `(or (fm-find-one ,starting ,(if (consp md-name)
                                      `(list ',(car md-name) ,(cadr md-name))
                                      `',md-name)
             :must-find t
             :skip-tree ,skip-tree
             :global-search t))
      `(fm-find-one ,starting ,(if (consp md-name)
                                  `(list ',(car md-name) ,(cadr md-name))
                                  `',md-name)
         :must-find t
         :skip-tree ,skip-tree
         :global-search t)))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(make-$instance nil nil)

What needs to change: Macro call that should be transformed by MAKE-$INSTANCE

Input: (make-$instance nil nil)

Output: (defmacro MAKE-$INSTANCE ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(gatherer nil)

Issue: Macro call that should be transformed by GATHERER

Input: (gatherer nil)

Output: (defmacro GATHERER ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(lambda () (progn))

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

Input: (lambda () (progn))

Output: (defmacro LAMBDA ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(dowhile-it nil)

Write a macro that addresses: Macro call that should be transformed by DOWHILE-IT

Input: (dowhile-it nil)

Output:
(defmacro dowhile-it (test &body body)
  "Like DOWHILE. IT is bound to TEST."
  `(do ((it ,test ,test))
       ((not it))
     ,@body))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(eif nil (progn))

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

Input: (eif nil (progn))

Output:
(defmacro eif (&whole whole test then &optional (else nil else?))
  "Like `cl:if', but expects two branches.

If there is only one branch a warning is signaled.

This macro is useful when writing explicit decision trees; it will
warn you if you forget a branch.

Short for “exhaustive if”."
  (unless else?
    (warn "Missing else-branch in eif form:~%~a"
          whole))
  `(if ,test ,then ,else))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(ekx nil nil)

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

Input: (ekx nil nil)

Output:
(defmacro ekx (ekx-id &rest body)
  (let ((result (gensym)))
     `(let ((,result (,@body)))
         (trc ,(string-downcase (symbol-name ekx-id)) :=> ,result)
         ,result)))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(with-ps-gensyms nil
  :key
  nil)

Problem: Macro call that should be transformed by WITH-PS-GENSYMS

Input:
(with-ps-gensyms nil
  :key
  nil)

Output: (defmacro WITH-PS-GENSYMS ...)


Instruction:
Generate a defmacro form that transforms code like this:
(multiple-value-bind nil :key nil)

Pattern to recognize: Macro call that should be transformed by MULTIPLE-VALUE-BIND

Input: (multiple-value-bind nil :key nil)

Output: (defmacro MULTIPLE-VALUE-BIND ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(etypecase-of nil
    nil)

Issue: Macro call that should be transformed by ETYPECASE-OF

Input:
(etypecase-of nil
    nil)

Output:
(defmacro etypecase-of (type x &body body)
  "Like `etypecase' but, at compile time, warn unless each clause in
BODY is a subtype of TYPE, and the clauses in BODY form an exhaustive
partition of TYPE."
  (once-only (x)
    `(typecase-of ,type ,x
       ,@body
       (otherwise
        (error 'type-error
               :datum ,x
               :expected-type ',type)))))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(ps-once-only nil)

Problem: Macro call that should be transformed by PS-ONCE-ONLY

Input: (ps-once-only nil)

Output: (defmacro PS-ONCE-ONLY ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(defobserver nil nil)

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

Input: (defobserver nil nil)

Output:
(defmacro defobserver (slotname &rest args &aux (aroundp (eq :around (first args))))
  (when aroundp (setf args (cdr args)))

  #+irritating
  (when (find slotname '(value kids))
    (warn "d: did you mean .value or .kids when you coded ~a?" slotname))

  (destructuring-bind ((&optional (self-arg 'self) (new-varg 'new-value)
                         (oldvarg 'old-value) (oldvargboundp 'old-value-boundp) (cell-arg 'c))
                       &body output-body) args
    `(progn
       (eval-when (:compile-toplevel :load-toplevel :execute)
         (setf (get ',slotname :output-defined) t))
       ,(if (eql (last1 output-body) :test)
            (let ((temp1 (gensym))
                  (loc-self (gensym)))
              `(defmethod slot-value-observe #-(or cormanlisp) ,(if aroundp :around 'progn)
                 ((slotname (eql ',slotname)) ,self-arg ,new-varg ,oldvarg ,oldvargboundp ,cell-arg)
                 (let ((,temp1 (bump-output-count ,slotname))
                       (,loc-self ,(if (listp self-arg)
                                       (car self-arg)
                                     self-arg)))
                   (when (and ,oldvargboundp ,oldvarg)
                     (format t "~&output ~d (~a ~a) old: ~a" ,temp1 ',slotname ,loc-self ,oldvarg ,cell-arg))
                   (format t "~&output ~d (~a ~a) new: ~a" ,temp1 ',slotname ,loc-self ,new-varg ,cell-arg))))
          `(defmethod slot-value-observe
               #-(or cormanlisp) ,(if aroundp :around 'progn)
             ((slotname (eql ',slotname)) ,self-arg ,new-varg ,oldvarg ,oldvargboundp ,cell-arg)
             (declare (ignorable
                       ,@(flet ((arg-name (arg-spec)
                                  (etypecase arg-spec
                                    (list (car arg-spec))
                                    (atom arg-spec))))
                           (list (arg-name self-arg)(arg-name new-varg)
                             (arg-name oldvarg)(arg-name oldvargboundp) (arg-name cell-arg)))))
             ,@output-body)))))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(collecting-into 'lol-gen::some-name)

Write a macro that addresses: Macro call that should be transformed by COLLECTING-INTO

Input: (collecting-into 'lol-gen::some-name)

Output: (defmacro COLLECTING-INTO ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(collect-product nil (progn))

What needs to change: Macro call that should be transformed by COLLECT-PRODUCT

Input: (collect-product nil (progn))

Output: (defmacro COLLECT-PRODUCT ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(defvar nil nil)

Issue: Macro call that should be transformed by DEFVAR

Input: (defvar nil nil)

Output: (defmacro DEFVAR ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(lambda-match
  nil
  nil)

Write a macro that addresses: Macro call that should be transformed by LAMBDA-MATCH

Input:
(lambda-match
  nil
  nil)

Output: (defmacro LAMBDA-MATCH ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(resolving
  nil
  :key
  nil)

Issue: Macro call that should be transformed by RESOLVING

Input:
(resolving
  nil
  :key
  nil)

Output: (defmacro RESOLVING ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(order-by nil :key nil)

Problem: Macro call that should be transformed by ORDER-BY

Input: (order-by nil :key nil)

Output: (defmacro ORDER-BY ...)


Instruction:
Generate a defmacro form that transforms code like this:
(dynamic-progv nil
    nil)

Pattern to recognize: Macro call that should be transformed by DYNAMIC-PROGV

Input:
(dynamic-progv nil
    nil)

Output: (defmacro DYNAMIC-PROGV ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(send nil (progn))

Issue: Macro call that should be transformed by SEND

Input: (send nil (progn))

Output: (defmacro SEND ...)


Instruction:
Generate a defmacro form that transforms code like this:
(dynamic-extent common-lisp:nil)

Pattern to recognize: Macro call that should be transformed by DYNAMIC-EXTENT

Input: (dynamic-extent common-lisp:nil)

Output: (defmacro DYNAMIC-EXTENT ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(define-type-alias 'lol-gen::some-name)

What needs to change: Macro call that should be transformed by DEFINE-TYPE-ALIAS

Input: (define-type-alias 'lol-gen::some-name)

Output: (defmacro DEFINE-TYPE-ALIAS ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(disable-quasiquote-2.0)

Issue: Macro call that should be transformed by DISABLE-QUASIQUOTE-2.0

Output: (defmacro DISABLE-QUASIQUOTE-2.0 ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(fm-other nil)

Issue: Macro call that should be transformed by FM-OTHER

Input: (fm-other nil)

Output:
(defmacro fm-other (md-name &key (starting 'self) skip-tree (test '#'true-that))
  `(fm-find-one ,starting ,(if (consp md-name)
                               `(list ',(car md-name) ,(cadr md-name))
                             `',md-name)
                :must-find t
                :skip-tree ,skip-tree
                :global-search t
                :test ,test))


Instruction:
Generate a defmacro form that transforms code like this:
(f_
  nil)

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

Input:
(f_
  nil)

Output: (defmacro F_ ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(with-constant-inject-hook nil)

Issue: Macro call that should be transformed by WITH-CONSTANT-INJECT-HOOK

Input: (with-constant-inject-hook nil)

Output:
(defmacro with-constant-inject-hook (func &body body)
  (let ((func-name (gensym "hook")))
    `(let* ((,func-name ,func)
            (*constant-inject-hook* ,func-name))
       ,@body)))


Instruction:
Generate a defmacro form that transforms code like this:
(defrule nil)

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

Input: (defrule nil)

Output: (defmacro DEFRULE ...)


Instruction:
Generate a defmacro form that transforms code like this:
(with-access-values nil
    nil)

Pattern to recognize: Macro call that should be transformed by WITH-ACCESS-VALUES

Input:
(with-access-values nil
    nil)

Output:
(defmacro with-access-values ((&rest bindings) obj &body body)
  "A macro which binds local variables from accessed values on object
   according to bindings

   bindings: (local-symbol-and-access-key
              or (local-symbol access-key)
               ...)
   obj: the thing we are accessing data from
  "
  (flet ((key-for (it)
           (etypecase it
             (symbol `(quote ,it))
             ((or string keyword list) it))))
    (let* ((o (gensym "OBJ"))
           (expanded-bindings
             (iter (for b in (ensure-list bindings))
               (when (first-iteration-p)
                 (collect `(,o ,obj)))
               (typecase b
                 (null)
                 (list (collect `(,(first b) (access ,o ,(key-for (second b))))))
                 (symbol (collect `(,b (access ,o ,(key-for b)))))))))
      `(let* ,expanded-bindings
        ,@body))))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(define-class nil
    :key
    nil)

What needs to change: Macro call that should be transformed by DEFINE-CLASS

Input:
(define-class nil
    :key
    nil)

Output: (defmacro DEFINE-CLASS ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(collect-nconc nil)

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

Input: (collect-nconc nil)

Output: (defmacro COLLECT-NCONC ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(dispatch-caseql 'lol-gen::some-name)

Problem: Macro call that should be transformed by DISPATCH-CASEQL

Input: (dispatch-caseql 'lol-gen::some-name)

Output:
(defmacro dispatch-caseql ((&rest exprs-and-types) &body clauses)
  "Like `dispatch-case', but types in clauses are implicitly wrapped in `eql'.
The syntax of `dispatch-caseql' is tohus closer to `case' than to
`typecase'."
  (expect-form-list
   `(dispatch-case ,exprs-and-types
      ,@(expand-dispatch-caseql-clauses clauses))))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(with-access nil
    (progn))

What needs to change: Macro call that should be transformed by WITH-ACCESS

Input:
(with-access nil
    (progn))

Output:
(defmacro with-access ((&rest keys) val-form &body body)
  "Similar to with-accessors except using the access functions"
  (let* ((gval (gensym "val"))
     (forms
      (iter (for k in keys)
        (for (k-to k-from) = (if (listp k) k (list k k)))
        (collect `(,k-to (access ,gval ',k-from))))))
    `(let ((,gval ,val-form))
       (declare (ignorable ,gval))
       (symbol-macrolet (,@forms)
     ,@body
     ))))


Instruction:
Generate a defmacro form that transforms code like this:
(loop)

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

Input: (loop)

Output: (defmacro LOOP ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(incf nil)

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

Input: (incf nil)

Output: (defmacro INCF ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(do-tags-in-lexenv 'lol-gen::some-name)

Write a macro that addresses: Macro call that should be transformed by DO-TAGS-IN-LEXENV

Input: (do-tags-in-lexenv 'lol-gen::some-name)

Output: (defmacro DO-TAGS-IN-LEXENV ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(iterate
  'lol-gen::some-name)

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

Input:
(iterate
  'lol-gen::some-name)

Output:
(defmacro iterate (&body body)
  "Jonathan Amsterdam's powerful iteration facility"
  `(iter .,body))


Instruction:
Generate a defmacro form that transforms code like this:
(lambda-match*)

Pattern to recognize: Macro call that should be transformed by LAMBDA-MATCH*

Input: (lambda-match*)

Output:
(defmacro lambda-match* (&body body)
  "Equivalent to (lambda (args...) (match* (args...) BODY...))."
  (multiple-value-bind (preamble clauses) (parse-matcher-body body)
    (let ((gensyms (make-gensyms (caar clauses))))
      `(lambda ,gensyms
         ,@preamble
         (match* ,gensyms
           ,@clauses)))))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(as-> nil
    (progn))

Write a macro that addresses: Macro call that should be transformed by AS->

Input:
(as-> nil
    (progn))

Output:
(defmacro as-> (init var &body exps)
  `(let ((,var ,init))
     ,var
     ,@(loop for (exp next-exp) on exps
          collect (if next-exp `(setf ,var ,exp) exp))))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(with-contracts-enabled nil
  (progn))

Problem: Macro call that should be transformed by WITH-CONTRACTS-ENABLED

Input:
(with-contracts-enabled nil
  (progn))

Output:
(defmacro with-contracts-enabled
    ((&rest args &key invariants preconditions postconditions) &body body)
  "Enables/disables contracts for the extent of this form, restoring them to
   their prior values upon exit."
  (declare (ignore invariants preconditions postconditions))
  (let ((enabled-contracts (gensym "ENABLED-CONTRACTS-")))
    `(let ((,enabled-contracts (enabled-contracts)))
       (unwind-protect
            (progn (enable-contracts ,@args)
                   ,@body)
         (apply #'enable-contracts ,enabled-contracts)))))


Instruction:
Generate a defmacro form that transforms code like this:
(with-slots nil
    (progn))

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

Input:
(with-slots nil
    (progn))

Output: (defmacro WITH-SLOTS ...)


Instruction:
Generate a defmacro form that transforms code like this:
(order-by 'lol-gen::some-name)

Pattern to recognize: Macro call that should be transformed by ORDER-BY

Input: (order-by 'lol-gen::some-name)

Output:
(defmacro order-by (&rest expressions)
  `(make-clause :order-by ,@(expand-expression expressions)))


Instruction:
Generate a defmacro form that transforms code like this:
(fm-map nil (progn))

Pattern to recognize: Macro call that should be transformed by FM-MAP

Input: (fm-map nil (progn))

Output:
(defmacro fm-map (fn md-name)
         `(mapcar ,fn (fm-find-all self ',md-name)))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(fluid-bind 'lol-gen::some-name)

What needs to change: Macro call that should be transformed by FLUID-BIND

Input: (fluid-bind 'lol-gen::some-name)

Output:
(defmacro fluid-bind ((&rest bindings) &body body)
  "Fluid-bind is an extension of bind that handles setting and resetting places. For example, suppose that an object of class foo has a slot named bar whose value is currently 3. The following code would evaluate the inner body with bar bound to 17 and restore it when the inner body is exited.

\(fluid-bind \(\(\(bar foo\) 17\)\)
  \(print \(bar foo\)\)\)
\(print \(bar foo\)\)
==> \(prints 17, then 3\)

This is similar to dynamic-binding but _much_ less robust."
  ;; does not handle declarations correctly
  (let ((setup-forms nil)
        (cleanup-forms nil)
        (gensyms nil))
    (loop for binding in bindings collect
          (destructuring-bind
		(setup-form cleanup-form)
	      (cond ((consp binding)
		     (destructuring-bind (var value) binding
		       (let ((g (gensym)))
			 (push g gensyms)
			 (cond ((atom var)
				`((:bind (,var ,value)) nil)
				#+(or)
				;; lexical or special?
				(if (boundp var)
				    `((:bind (,var ,value)) nil)
				    `((:setf (setf ,g ,var ,var ,value))
				      (setf ,var ,g))))
			       ((and (fboundp (first var))
				     (not (eq (first var) 'values)))
				;; putative place
				`((:setf (setf ,g ,var ,var ,value))
				  (setf ,var ,g)))
			       (t
				`((:bind (,var ,value)) nil))))))
		    (t
		     `((:bind (,binding nil)) nil)))
            (push setup-form setup-forms)
            (push cleanup-form cleanup-forms)))
    (let ((result body))
      (mapc (lambda (setup cleanup)
              (setf result
                    (ecase (first setup)
                      (:setf `((unwind-protect
                                 (progn
                                   ,(second setup)
                                   ,@result)
                                 ,cleanup)))
                      (:bind `((bind (,(second setup))
                                 ,@result)))))
              result)
            setup-forms cleanup-forms)
      `(let ,gensyms
         (declare (ignorable ,@gensyms))
         ,@result))))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(match nil
  nil)

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

Input:
(match nil
  nil)

Output: (defmacro MATCH ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(with nil (progn))

Problem: Macro call that should be transformed by WITH

Input: (with nil (progn))

Output: (defmacro WITH ...)


Instruction:
Generate a defmacro form that transforms code like this:
(acase nil
  (progn))

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

Input:
(acase nil
  (progn))

Output:
(defmacro acase (keyform &body cases)
  "Like CASE, except binds the result of the keyform to IT (via LET) for the
scope of the cases."
  `(anaphoric case ,keyform ,@cases))


Instruction:
Generate a defmacro form that transforms code like this:
(xor 'lol-gen::some-name)

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

Input: (xor 'lol-gen::some-name)

Output:
(defmacro xor (&rest args)
  "Evaluates the ARGS one at a time. If more than one is T,
   evaluation stops and NIL is returned. If exactly one arg is T,
   that value is returned."
  (let ((state (gensym "XOR-state-"))
        (block-name (gensym "XOR-block-"))
        (arg-temp (gensym "XOR-arg-temp-")))
    `(let (,state
           ,arg-temp)
       (block ,block-name
         ,@(loop
              :for arg :in args
              :collect `(setf ,arg-temp ,arg)
              :collect `(when ,arg-temp
                          ;; arg is T, this can change the state
                          (if ,state
                              ;; a second T value, return NIL
                              (return-from ,block-name nil)
                              ;; a first T, swap the state
                              (setf ,state ,arg-temp))))
         (return-from ,block-name ,state)))))


Instruction:
Generate a defmacro form that transforms code like this:
(cll-inner 'lol-gen::some-name)

Pattern to recognize: Macro call that should be transformed by CLL-INNER

Input: (cll-inner 'lol-gen::some-name)

Output:
(defmacro cll-inner (expr)
  `(,expr outer-val))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(f-plusp 'lol-gen::some-name)

Write a macro that addresses: Macro call that should be transformed by F-PLUSP

Input: (f-plusp 'lol-gen::some-name)

Output:
(defmacro f-plusp (key &rest body)
  `(with-synapse ,key (prior-fire-value)
     (let ((new-basis (progn ,@body)))
       (values new-basis (if (xor prior-fire-value (plusp new-basis))
                             (progn
                               (setf prior-fire-value (plusp new-basis))
                               :propagate)
                           :no-propagate)))))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(cond->> nil (progn))

Problem: Macro call that should be transformed by COND->>

Input: (cond->> nil (progn))

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


Instruction:
Generate a defmacro form that transforms code like this:
(with-unknown-first-class-functions-allowed
  nil
  :key
  nil)

Pattern to recognize: Macro call that should be transformed by WITH-UNKNOWN-FIRST-CLASS-FUNCTIONS-ALLOWED

Input:
(with-unknown-first-class-functions-allowed
  nil
  :key
  nil)

Output:
(defmacro with-unknown-first-class-functions-allowed (&body body)
  `(let ((*allow-call-function-signature* t))
     ,@body))


Instruction:
Generate a defmacro form that transforms code like this:
(type common-lisp:nil
    (common-lisp:progn))

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

Input:
(type common-lisp:nil
    (common-lisp:progn))

Output: (defmacro TYPE ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(alter-table nil
  :key
  nil)

Issue: Macro call that should be transformed by ALTER-TABLE

Input:
(alter-table nil
  :key
  nil)

Output:
(defmacro alter-table (table &body clauses)
  `(make-statement :alter-table
                   ,(expand-expression table) ,@clauses))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(select nil)

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

Input: (select nil)

Output:
(defmacro select (fields &body clauses)
  `(make-statement :select
                   ,(match fields
                      ((or (list* (type keyword) _)
                           (list* (list* (type keyword) _) _))
                       `(make-clause :fields
                                     ,@(mapcar #'expand-op fields)))
                      ((type keyword) `(fields ,fields))
                      ((or (type symbol)
                           (list* (type symbol) _))
                       `(convert-if-fields-clause ,fields))
                      (otherwise fields))
                   ,@clauses))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(define-method-combination 'lol-gen::some-name)

Problem: Macro call that should be transformed by DEFINE-METHOD-COMBINATION

Input: (define-method-combination 'lol-gen::some-name)

Output:
(defmacro define-method-combination (name &rest args)
  `(progn
     (define-method-combination% ,name ,@args)
     (c2mop:define-method-combination ,name ,@args)))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(fn common-lisp:nil
  :key
  common-lisp:nil)

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

Input:
(fn common-lisp:nil
  :key
  common-lisp:nil)

Output: (defmacro FN ...)


Instruction:
Generate a defmacro form that transforms code like this:
(w/uniqs nil
  nil)

Pattern to recognize: Macro call that should be transformed by W/UNIQS

Input:
(w/uniqs nil
  nil)

Output: (defmacro W/UNIQS ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(dispatch-case-let nil)

What needs to change: Macro call that should be transformed by DISPATCH-CASE-LET

Input: (dispatch-case-let nil)

Output:
(defmacro dispatch-case-let ((&rest bindings) &body clauses &environment env)
  "Like `dispatch-case', but establish new bindings for each expression.

For example,

    (dispatch-case-let (((x string) (expr1))
                        ((y string) (expr2)))
      ...)

is equivalent to

    (let ((x (expr1))
          (y (expr2)))
      (dispatch-case ((x string)
                      (y string))
        ...))

It may be helpful to think of this as a cross between
`defmethod' (where the (variable type) notation is used in the lambda
list) and `let' (which has an obvious macro-expansion in terms of
`lambda')."
  (multiple-value-bind (vars types exprs)
      ;; Split the bindings and types.
      (with-collectors (vars-out types-out exprs-out)
        (flet ((vars-out (var) (vars-out (ensure-var var))))
          (dolist (binding bindings)
            (ematch binding
              ((list (and var (type symbol)) expr)
               (vars-out var)
               (types-out t)
               (exprs-out expr))
              ((list (list (and var (type symbol)) type) expr)
               (vars-out var)
               (types-out type)
               (exprs-out expr))))))
    (let ((normalized-clauses
            ;; Normalize asterisks into the types of the corresponding
            ;; variables.
            (loop for (clause-types . clause-body) in clauses
                  collect (cons
                           (loop for clause-type in clause-types
                                 for type in types
                                 if (eql clause-type '*)
                                   collect type
                                 else collect clause-type)
                           clause-body))))
      (with-unique-names (block)
        (multiple-value-bind (tags final-clauses)
            (hoist-clause-bodies block normalized-clauses env)
          `(let ,(mapcar #'list vars exprs)
             (with-read-only-vars ,vars
               (block ,block
                 (tagbody
                    (dispatch-case/nobindings ,(mapcar #'list vars types)
                      ,@final-clauses)
                    ,@tags)))))))))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(static-load-time-value nil nil)

Problem: Macro call that should be transformed by STATIC-LOAD-TIME-VALUE

Input: (static-load-time-value nil nil)

Output:
(defmacro static-load-time-value
    (form &optional (read-only-p nil read-only-p-supplied?))
  "Like `load-time-value', but signals an error if it cannot preserve identity.

On close reading of the standard, in a function that is evaluated but
not compiled, it is permissible for implementations to repeatedly
execute a `load-time-value' form, and in fact some implementations do
this \(including, at the time of writing, ABCL, CLISP, Allegro and
LispWorks).

When `static-load-time-value' is compiled, it behaves exactly like
`load-time-value'. Otherwise it conducts a run-time check to ensure
that `load-time-value' preserves identity."
  ;; Thanks to Jean-Philippe Paradis and Michał Herda for helping to
  ;; diagnose and treat the problem here.
  (if *compile-file-truename*
      `(load-time-value ,form
                        ,@(and read-only-p-supplied? (list read-only-p)))
      `(progn
         (flet ((fn () (load-time-value (random most-positive-fixnum))))
           (declare (dynamic-extent #'fn) (ignorable #'fn)
                    #+LispWorks (notinline fn))
           ;; Do the actual test out of line.
           (test-load-time-value #'fn ',form ',read-only-p))
         (load-time-value ,form
                          ,@(and read-only-p-supplied? (list read-only-p))))))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(summing-to-and-returning nil (progn))

Write a macro that addresses: Macro call that should be transformed by SUMMING-TO-AND-RETURNING

Input: (summing-to-and-returning nil (progn))

Output: (defmacro SUMMING-TO-AND-RETURNING ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(ecase-of nil
    (progn))

Issue: Macro call that should be transformed by ECASE-OF

Input:
(ecase-of nil
    (progn))

Output:
(defmacro ecase-of (type x &body body)
  "Like `ecase' but, given a TYPE (which should be defined as `(member
...)'), warn, at compile time, unless the keys in BODY are all of TYPE
and, taken together, they form an exhaustive partition of TYPE."
  (once-only (x)
    `(case-of ,type ,x
       ,@body
       (otherwise
        (error 'type-error
               :datum ,x
               :expected-type ',type)))))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(lambda-coro
  nil
  (progn))

Write a macro that addresses: Macro call that should be transformed by LAMBDA-CORO

Input:
(lambda-coro
  nil
  (progn))

Output: (defmacro LAMBDA-CORO ...)


Instruction:
Generate a defmacro form that transforms code like this:
(isnt-values nil
  (progn))

Pattern to recognize: Macro call that should be transformed by ISNT-VALUES

Input:
(isnt-values nil
  (progn))

Output:
(defmacro isnt-values (form &body body)
  (multiple-value-bind (comp-expected expected comparison description format-args)
      (destructure-is-values-body body)
    `(eval-in-context
      *context*
      (make-instance 'multiple-value-comparison-result
                     :expression '(isnt-values ,form ,@comp-expected)
                     :value-form ',form
                     :body (lambda () ,form)
                     :expected (list ,@expected)
                     :comparison (list ,@comparison)
                     :comparison-geq NIL
                     ,@(when description
                         `(:description (format NIL ,description ,@format-args)))))))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(untrace nil (progn))

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

Input: (untrace nil (progn))

Output: (defmacro UNTRACE ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(synchronized nil
  nil)

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

Input:
(synchronized nil
  nil)

Output:
(defmacro synchronized ((&optional (object nil objectp)) &body body &environment env)
  "Run BODY holding a unique lock associated with OBJECT.
If no OBJECT is provided, run BODY as an anonymous critical section.

If BODY begins with a literal string, attach the string to the lock
object created (as the argument to `bt:make-recursive-lock')."
  (multiple-value-bind (string? body)
      (if (stringp (first body))
          (values (first body) (rest body))
          (values nil body))
    (let* ((form (lock-form object objectp env string?)))
      (with-gensyms (lock)
        `(let ((,lock ,form))
           (bt:with-recursive-lock-held (,lock)
             ;; On some Lisps this would return T if empty.
             ,@(or body '(nil))))))))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(with-ps-gensyms 'lol-gen::some-name)

Write a macro that addresses: Macro call that should be transformed by WITH-PS-GENSYMS

Input: (with-ps-gensyms 'lol-gen::some-name)

Output: (defmacro WITH-PS-GENSYMS ...)


Instruction:
Generate a defmacro form that transforms code like this:
(as->* nil (progn))

Pattern to recognize: Macro call that should be transformed by AS->*

Input: (as->* nil (progn))

Output: (defmacro AS->* ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(match* 'lol-gen::some-name)

Problem: Macro call that should be transformed by MATCH*

Input: (match* 'lol-gen::some-name)

Output:
(defmacro match* (whats &body clauses)
  #.+match*-doc+
  `(match2* ,whats
     ,@clauses
     (_ nil)))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(defvar* nil :key nil)

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

Input: (defvar* nil :key nil)

Output: (defmacro DEFVAR* ...)


Instruction:
Generate a defmacro form that transforms code like this:
(decf nil (progn))

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

Input: (decf nil (progn))

Output: (defmacro DECF ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(enable-dot-syntax)

What needs to change: Macro call that should be transformed by ENABLE-DOT-SYNTAX

Input: (enable-dot-syntax)

Output:
(defmacro enable-dot-syntax ()
  "Enable reader syntax."
  `(eval-when (:compile-toplevel :load-toplevel :execute)
    (%enable-dot-syntax)))


Instruction:
Generate a defmacro form that transforms code like this:
(cond-bind 'lol-gen::some-name)

Pattern to recognize: Macro call that should be transformed by COND-BIND

Input: (cond-bind 'lol-gen::some-name)

Output: (defmacro COND-BIND ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(actypecase nil)

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

Input: (actypecase nil)

Output:
(defmacro actypecase (keyform &body cases)
  "Like CTYPECASE, except binds the result of the keyform to IT (via LET) for
the scope of the cases. Unlike CTYPECASE, new values possible stored by the
STORE-VALUE restart are not received by the keyform/place, but by IT."
  `(anaphoric ctypecase ,keyform ,@cases))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(all nil)

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

Input: (all nil)

Output:
(defmacro all (parser &rest parsers)
  "Combination of parsers yielding all results as a list."
  `(<*> ,parser ,@parsers))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(when-let* nil
  nil)

What needs to change: Macro call that should be transformed by WHEN-LET*

Input:
(when-let* nil
  nil)

Output:
(defmacro when-let* (bindings &body body)
  "Creates new variable bindings, and conditionally executes BODY.

BINDINGS must be either single binding of the form:

 (variable initial-form)

or a list of bindings of the form:

 ((variable-1 initial-form-1)
  (variable-2 initial-form-2)
  ...
  (variable-n initial-form-n))

Each INITIAL-FORM is executed in turn, and the variable bound to the
corresponding value. INITIAL-FORM expressions can refer to variables
previously bound by the WHEN-LET*.

Execution of WHEN-LET* stops immediately if any INITIAL-FORM evaluates to NIL.
If all INITIAL-FORMs evaluate to true, then BODY is executed as an implicit
PROGN."
  (let ((binding-list (if (and (consp bindings) (symbolp (car bindings)))
                          (list bindings)
                          bindings)))
    (labels ((bind (bindings body)
               (if bindings
                   `(let (,(car bindings))
                      (when ,(caar bindings)
                        ,(bind (cdr bindings) body)))
                   `(progn ,@body))))
      (bind binding-list body))))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(defproto nil)

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

Input: (defproto nil)

Output: (defmacro DEFPROTO ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(define-global-var* nil (progn))

Issue: Macro call that should be transformed by DEFINE-GLOBAL-VAR*

Input: (define-global-var* nil (progn))

Output: (defmacro DEFINE-GLOBAL-VAR* ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(shiftf nil :key nil)

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

Input: (shiftf nil :key nil)

Output: (defmacro SHIFTF ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(define-module nil
  :key
  nil)

Issue: Macro call that should be transformed by DEFINE-MODULE

Input:
(define-module nil
  :key
  nil)

Output:
(defmacro define-module (name &body options)
  (let ((name (string name))
        (package (gensym "PACKAGE")))
    `(eval-when (:compile-toplevel :load-toplevel :execute)
       (let ((,package (or (find-package ,name)
                           (make-package ,name :use ()))))
         (modularize :package ,package :name ,name)
         (expand-module ,name ',options)
         ,package))))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(reversef 'lol-gen::some-name)

Problem: Macro call that should be transformed by REVERSEF

Input: (reversef 'lol-gen::some-name)

Output: (defmacro REVERSEF ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(the-kids nil)

What needs to change: Macro call that should be transformed by THE-KIDS

Input: (the-kids nil)

Output:
(defmacro the-kids (&rest kids)
  `(let ((*parent* self))
     (packed-flat! ,@kids)))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(export-always nil nil)

Write a macro that addresses: Macro call that should be transformed by EXPORT-ALWAYS

Input: (export-always nil nil)

Output:
(defmacro export-always (symbols &optional (package nil package-supplied?))
  "Like `export', but also evaluated at compile time."
  `(eval-when (:compile-toplevel :load-toplevel :execute)
     (export ,symbols ,@(and package-supplied? (list package)))))


Instruction:
Define a macro that eliminates this repetitive pattern:
(lambda-match
  common-lisp:nil
  :key
  common-lisp:nil)

Issue: Macro call that should be transformed by LAMBDA-MATCH

Input:
(lambda-match
  common-lisp:nil
  :key
  common-lisp:nil)

Output:
(defmacro lambda-match (&body body)
  "Equivalent to (lambda (arg) (match arg BODY...))."
  (multiple-value-bind (preamble clauses) (parse-matcher-body body)
    (with-gensyms (clause)
      `(lambda (,clause)
         ,@preamble
         (match ,clause
           ,@clauses)))))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(with-boolean nil)

Problem: Macro call that should be transformed by WITH-BOOLEAN

Input: (with-boolean nil)

Output:
(defmacro with-boolean ((&rest branches) &body body
                        &environment env)
  "Establishes a lexical environment in which it is possible to use
macroexpand-time branching. Within the lexical scope of
`with-boolean', it is possible to use `boolean-if', `boolean-when',
and `boolean-unless' to conditionalize whether some forms are included
at compilation time. (You may also use `:if', `:when', or `:unless'
for brevity.)
\
The first argument must be a list of symbols which name variables. This macro
will expand into a series of conditionals"
  (cond (*boolean-bypass*
         `(progn ,@body))
        (t (let ((all-branches (macroexpand-1 '%all-branches% env)))
             `(macrolet ((:if (cond then else)
                              (list 'boolean-if cond then else))
                         (:when (cond &body then)
                           (list* 'boolean-when cond then))
                         (:unless (cond &body then)
                           (list* 'boolean-unless cond then)))
                (locally
                    (declare #+sbcl (sb-ext:disable-package-locks
                                     %in-branching% %all-branches%)
                             #+sbcl (sb-ext:muffle-conditions
                                     sb-ext:code-deletion-note))
                  (symbol-macrolet ((%in-branching% t)
                                    (%all-branches% (,@branches ,@all-branches))
                                    (%true-branches% ()))
                    (locally (declare #+sbcl (sb-ext:enable-package-locks
                                              %in-branching% %all-branches%))
                      (%with-boolean ,branches ,@body)))))))))


Instruction:
Generate a defmacro form that transforms code like this:
(current-decoder)

Pattern to recognize: Macro call that should be transformed by CURRENT-DECODER

Input: (current-decoder)

Output:
(defmacro current-decoder (&rest keys)
  "Capture current values of custom variables and return a custom
decoder which restores these values in its dynamic environment."
  (let (exterior-bindings customizations)
    (flet ((collect (key var)
             (let ((exterior (gensym)))
               (push (list exterior var) exterior-bindings)
               (push exterior customizations)
               (push key customizations))))
      (if keys
          (loop for key in keys
             do (collect key (custom-key-to-variable key)))
          (loop-on-custom (key var)
             do (collect key var)))
      `(let ,exterior-bindings
         (custom-decoder ,@customizations)))))


Instruction:
Define a macro that eliminates this repetitive pattern:
(cond-> nil
  (progn))

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

Input:
(cond-> nil
  (progn))

Output: (defmacro cond-> (init &body exps) (cond-arrow-macro init exps))


Instruction:
Generate a defmacro form that transforms code like this:
(for-all nil
  :key
  nil)

Pattern to recognize: Macro call that should be transformed by FOR-ALL

Input:
(for-all nil
  :key
  nil)

Output:
(defmacro for-all (bindings &body body)
  "Bind BINDINGS to random variables and test BODY *num-trials* times.

BINDINGS is a list of binding forms, each element is a list
of (BINDING VALUE &optional GUARD). Value, which is evaluated
once when the for-all is evaluated, must return a generator which
be called each time BODY is evaluated. BINDING is either a symbol
or a list which will be passed to destructuring-bind. GUARD is a
form which, if present, stops BODY from executing when IT returns
NIL. The GUARDS are evaluated after all the random data has been
generated and they can refer to the current value of any
binding. NB: Generator forms, unlike guard forms, can not contain
references to the bound variables.

Examples:

  (for-all ((a (gen-integer)))
    (is (integerp a)))

  (for-all ((a (gen-integer) (plusp a)))
    (is (integerp a))
    (is (plusp a)))

  (for-all ((less (gen-integer))
            (more (gen-integer) (< less more)))
    (is (<= less more)))

  (for-all (((a b) (gen-two-integers)))
    (is (integerp a))
    (is (integerp b)))"
  (with-gensyms (test-lambda-args)
    `(perform-random-testing
      (list ,@(mapcar #'second bindings))
      (lambda (,test-lambda-args)
        (destructuring-bind ,(mapcar #'first bindings)
            ,test-lambda-args
          (if (and ,@(delete-if #'null (mapcar #'third bindings)))
              (progn ,@body)
              (throw 'run-once
                (list :guard-conditions-failed))))))))


Instruction:
Generate a defmacro form that transforms code like this:
(with-savepoint nil
  :key
  nil)

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

Input:
(with-savepoint nil
  :key
  nil)

Output:
(defmacro with-savepoint (name &body body)
  "Can only be used within a transaction. Establishes a savepoint with the given
name at the start of body, and binds the same name to a handle for that savepoint.
The body is executed and, at the end of body, the savepoint is released, unless a
condition is thrown, in which case it is rolled back. Execute the body within a
savepoint, releasing savepoint when the body exits normally, and rolling back
otherwise. NAME is both the variable that can be used to release or rolled back
before the body unwinds, and the SQL name of the savepoint.

An example might look like this:

(defun test12 (x &optional (y nil))
  (with-logical-transaction (lt1 :read-committed-rw)
    (execute (:insert-into 'test-data :set 'value 0))
    (with-savepoint sp1
      (execute (:insert-into 'test-data :set 'value 1))
      (if (< x 0)
          (rollback-savepoint sp1)
          (release-savepoint sp1)))
    (with-savepoint sp2
      (execute (:insert-into 'test-data :set 'value 2))
      (with-savepoint sp3
        (execute (:insert-into 'test-data :set 'value 3))
        (if (> x 0)
            (rollback-savepoint sp3)
            (release-savepoint sp3))
        (when y (rollback-savepoint sp2)))
      (if (= x 0)
          (rollback-savepoint sp2)
          (release-savepoint sp2)))
    (when (string= y \"abrt\")
      (abort-transaction lt1))))"

  `(call-with-savepoint ',name (lambda (,name)
                                 (declare (ignorable ,name)) ,@body)))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(untrace 'lol-gen::some-name)

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

Input: (untrace 'lol-gen::some-name)

Output: (defmacro UNTRACE ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(set-arg-list-key-value! nil :key nil)

What needs to change: Macro call that should be transformed by SET-ARG-LIST-KEY-VALUE!

Input: (set-arg-list-key-value! nil :key nil)

Output:
(defmacro set-arg-list-key-value! (new ids place &key (test '#'equalper) (key '#'identity))
  `(progn
    (iter (for id in (ensure-list ,ids))
      (setf ,place (set-arg-list-key-value ,new id ,place :test ,test :key ,key)))
    ,place))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(dynamic-reprogv nil
    nil)

What needs to change: Macro call that should be transformed by DYNAMIC-REPROGV

Input:
(dynamic-reprogv nil
    nil)

Output: (defmacro DYNAMIC-REPROGV ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(match2+ common-lisp:nil
    common-lisp:nil)

Issue: Macro call that should be transformed by MATCH2+

Input:
(match2+ common-lisp:nil
    common-lisp:nil)

Output:
(defmacro match2+ (what type &body clauses)
  "Variant of match2 : can specify the inferred type of the argument"
  `(match2*+ (,what) (,type)
     ,@(mapcar (lambda-ematch0
                 ((list* pattern body)
                  (list* (list pattern) body)))
               clauses)))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(assuref nil (progn))

Problem: Macro call that should be transformed by ASSUREF

Input: (assuref nil (progn))

Output:
(defmacro assuref (place type-spec)
  "Like `(progn (check-type PLACE TYPE-SPEC) PLACE)`, but evaluates
PLACE only once."
  (with-gensyms (temp)
    (let ((ts type-spec))
      `(the ,ts
            (values
             (let ((,temp ,place))
               (if (typep ,temp ',ts)
                   ,temp
                   (setf ,place (require-type-for ,temp ',ts ',place)))))))))


Instruction:
Define a macro that eliminates this repetitive pattern:
(prependf nil (progn))

Issue: Macro call that should be transformed by PREPENDF

Input: (prependf nil (progn))

Output: (defmacro PREPENDF ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(defmacro-clause 'lol-gen::some-name)

Issue: Macro call that should be transformed by DEFMACRO-CLAUSE

Input: (defmacro-clause 'lol-gen::some-name)

Output: (defmacro DEFMACRO-CLAUSE ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(nsib nil)

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

Input: (nsib nil)

Output:
(defmacro nsib (&optional (self-form 'self))
  (let ((self (gensym)))
    `(bwhen (,self ,self-form)
        (cadr (member ,self (kids (fm-parent ,self)))))))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(local
  nil
  nil)

Problem: Macro call that should be transformed by LOCAL

Input:
(local
  nil
  nil)

Output: (defmacro LOCAL ...)


Instruction:
Generate a defmacro form that transforms code like this:
(typecase-let 'lol-gen::some-name)

Pattern to recognize: Macro call that should be transformed by TYPECASE-LET

Input: (typecase-let 'lol-gen::some-name)

Output:
(defmacro typecase-let ((var expr) &body cases)
  "Like (let ((VAR EXPR)) (typecase VAR ...)), with VAR read-only."
  `(let1 ,var ,expr
     (typecase ,var
       ,@cases)))


Instruction:
Generate a defmacro form that transforms code like this:
(defprepared nil (progn))

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

Input: (defprepared nil (progn))

Output:
(defmacro defprepared (name query &optional (format :rows))
  "This is another macro variant of prepare. It is like prepare, but gives the
function a name which now becomes a top-level function for the prepared
statement. The name should not be a string but may be quoted."
  (when (consp name) (setf name (s-sql::dequote name)))
  `(let ((overwrite ,*allow-overwriting-prepared-statements*))
     ,(generate-prepared `(defun ,name) name query format)))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(lambda-cmatch*
  common-lisp:nil
  common-lisp:nil)

Write a macro that addresses: Macro call that should be transformed by LAMBDA-CMATCH*

Input:
(lambda-cmatch*
  common-lisp:nil
  common-lisp:nil)

Output:
(defmacro lambda-cmatch* (&body body)
  "Equivalent to (lambda (args...) (cmatch* (args...) BODY...))."
  (multiple-value-bind (preamble clauses) (parse-matcher-body body)
    (let ((gensyms (make-gensyms (caar clauses))))
      `(lambda ,gensyms
         ,@preamble
         (cmatch* ,gensyms
           ,@clauses)))))


Instruction:
Generate a defmacro form that transforms code like this:
(c-assert 'lol-gen::some-name)

Pattern to recognize: Macro call that should be transformed by C-ASSERT

Input: (c-assert 'lol-gen::some-name)

Output:
(defmacro c-assert (assertion &optional places fmt$ &rest fmt-args)
  (declare (ignorable assertion places fmt$ fmt-args))
   #+(or)`(progn)
  `(unless *stop*
     (unless ,assertion
       ,(if fmt$
            `(c-break ,fmt$ ,@fmt-args)
          `(c-break "failed assertion: ~a" ',assertion)))))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(make-nodelist 'lol-gen::some-name)

Problem: Macro call that should be transformed by MAKE-NODELIST

Input: (make-nodelist 'lol-gen::some-name)

Output:
(defmacro make-nodelist (items &key (prepend nil) (quoty nil))
  "Build general or specific nodelist."
  (let ((prepend (if (listp prepend) prepend `(,prepend))))
    `(nodelist
      (list ,@(loop for i in items collect
		(if prepend
		    (if quoty
			`(,@prepend (quoty ,i))
			`(,@prepend ,i))
		    `(make-node-function (quoty ,i))))))))


Instruction:
Generate a defmacro form that transforms code like this:
(define-test+run-interactively nil
  nil)

Pattern to recognize: Macro call that should be transformed by DEFINE-TEST+RUN-INTERACTIVELY

Input:
(define-test+run-interactively nil
  nil)

Output:
(defmacro define-test+run-interactively (name &body args-and-body)
  `(progn (define-test ,name ,@args-and-body)
          (eval-when (:execute)
            (values ',name (test ',name :report 'interactive)))))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(make-name-transformer nil (progn))

What needs to change: Macro call that should be transformed by MAKE-NAME-TRANSFORMER

Input: (make-name-transformer nil (progn))

Output: (defmacro MAKE-NAME-TRANSFORMER ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(defplace nil
    (progn))

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

Input:
(defplace nil
    (progn))

Output:
(defmacro defplace (name args &body body)
  "Define NAME and (SETF NAME) in one go.

BODY is a list of forms, starting with an optional docstring. The last
form in BODY, however, must be a single, setf-able expression."
  (match body
    ((list (type string))
     (error "No form for ~s: ~a" 'defplace body))
    ((last (cons (type string) nil) 1)
     `(defplace ,name ,args ,@(reverse body)))
    (otherwise
     (with-gensyms (value)
       `(progn
          (defun ,name ,args
            ,@body)
          (defun (setf ,name) (,value ,@args)
            ,@(butlast body)
            (setf ,(lastcar body) ,value)))))))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(with-condition-restarts nil
    :key
  nil)

Problem: Macro call that should be transformed by WITH-CONDITION-RESTARTS

Input:
(with-condition-restarts nil
    :key
  nil)

Output: (defmacro WITH-CONDITION-RESTARTS ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(define-method-combination nil)

What needs to change: Macro call that should be transformed by DEFINE-METHOD-COMBINATION

Input: (define-method-combination nil)

Output: (defmacro DEFINE-METHOD-COMBINATION ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(sunless nil
  :key
  nil)

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

Input:
(sunless nil
  :key
  nil)

Output:
(defmacro sunless (test &body body)
  "Like UNLESS, except binds the test form to IT (via SYMBOL-MACROLET) for the
scope of the body. IT can be set with SETF."
  `(symbolic unless ,test ,@body))


Instruction:
Generate a defmacro form that transforms code like this:
(or nil)

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

Input: (or nil)

Output: (defmacro OR ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(cond->> nil
  (progn))

Write a macro that addresses: Macro call that should be transformed by COND->>

Input:
(cond->> nil
  (progn))

Output: (defmacro cond->> (init &body exps) (cond-arrow-macro init exps t))


Instruction:
Generate a defmacro form that transforms code like this:
(fields nil :key nil)

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

Input: (fields nil :key nil)

Output:
(defmacro fields (&rest fields)
  `(make-clause :fields ,@(mapcar #'expand-op fields)))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(with-unique-names nil
  nil)

What needs to change: Macro call that should be transformed by WITH-UNIQUE-NAMES

Input:
(with-unique-names nil
  nil)

Output: (defmacro WITH-UNIQUE-NAMES ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(with-unique-names 'lol-gen::some-name)

What needs to change: Macro call that should be transformed by WITH-UNIQUE-NAMES

Input: (with-unique-names 'lol-gen::some-name)

Output:
(defmacro with-unique-names (names &body forms)
  "Alias for WITH-GENSYMS."
  `(with-gensyms ,names ,@forms))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(collecting
  nil)

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

Input:
(collecting
  nil)

Output:
(defmacro collecting (&body body)
  "Like `with-collector', with the collector bound to the result of
interning `collect' in the current package."
  (with-current-package-symbols (collect)
    `(with-collector (,collect)
       ,@body)))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(source-position nil :key nil)

Write a macro that addresses: Macro call that should be transformed by SOURCE-POSITION

Input: (source-position nil :key nil)

Output: (defmacro SOURCE-POSITION ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(define-simple-type-map nil nil)

Problem: Macro call that should be transformed by DEFINE-SIMPLE-TYPE-MAP

Input: (define-simple-type-map nil nil)

Output:
(defmacro define-simple-type-map (class type)
  `(defmethod type ((,class ,class))
     ',type))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(^fm-next-sib 'lol-gen::some-name)

What needs to change: Macro call that should be transformed by ^FM-NEXT-SIB

Input: (^fm-next-sib 'lol-gen::some-name)

Output:
(defmacro ^fm-next-sib (&optional (self 'self))
     (let ((s (gensym)))
        `(let ((,s ,self))
             (car (cdr (member ,s (kids (fm-parent ,s))))))))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(match2+ common-lisp:nil
    (common-lisp:progn))

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

Input:
(match2+ common-lisp:nil
    (common-lisp:progn))

Output:
(defmacro match2+ (what type &body clauses)
  "Variant of match2 : can specify the inferred type of the argument"
  `(match2*+ (,what) (,type)
     ,@(mapcar (lambda-ematch0
                 ((list* pattern body)
                  (list* (list pattern) body)))
               clauses)))


Instruction:
Generate a defmacro form that transforms code like this:
(appendf nil nil)

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

Input: (appendf nil nil)

Output: (defmacro APPENDF ...)


Instruction:
Generate a defmacro form that transforms code like this:
(one-value 'lol-gen::some-name)

Pattern to recognize: Macro call that should be transformed by ONE-VALUE

Input: (one-value 'lol-gen::some-name)

Output: (defmacro ONE-VALUE ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(in-optimizer 'lol-gen::some-name)

Write a macro that addresses: Macro call that should be transformed by IN-OPTIMIZER

Input: (in-optimizer 'lol-gen::some-name)

Output:
(defmacro in-optimizer (name &optional verbose)
  `(eval-when (:compile-toplevel :load-toplevel :execute)
     ,@(when verbose
         `((when ,verbose (format *trace-output* "~&Switching to the ~A optimizer~%" ',name))))
     (setf *optimizer* ',name)))


Instruction:
Define a macro that eliminates this repetitive pattern:
(eval-always
  common-lisp:nil)

Issue: Macro call that should be transformed by EVAL-ALWAYS

Input:
(eval-always
  common-lisp:nil)

Output: (defmacro EVAL-ALWAYS ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(inner-join nil)

Problem: Macro call that should be transformed by INNER-JOIN

Input: (inner-join nil)

Output:
(defmacro inner-join (table &key on using)
  `(join ,table :kind :inner :on ,on :using ,using))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(some-> nil nil)

Write a macro that addresses: Macro call that should be transformed by SOME->

Input: (some-> nil nil)

Output: (defmacro SOME-> ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(and-it nil (progn))

Problem: Macro call that should be transformed by AND-IT

Input: (and-it nil (progn))

Output:
(defmacro and-it (&rest args)
  "Like AND. IT is bound to the value of the previous AND form."
  (cond ((null args) t)
        ((null (cdr args)) (car args))
        (t `(when-it ,(car args) (and-it ,@(cdr args))))))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(defsynonym nil (progn))

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

Input: (defsynonym nil (progn))

Output: (defmacro DEFSYNONYM ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(define-port-value-slot nil (progn))

Problem: Macro call that should be transformed by DEFINE-PORT-VALUE-SLOT

Input: (define-port-value-slot nil (progn))

Output: (defmacro DEFINE-PORT-VALUE-SLOT ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(doiter nil
  (progn))

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

Input:
(doiter nil
  (progn))

Output:
(defmacro doiter (name/iter &body body)
  "Sames as DOITERS however for the special case of iterating over a
   single sequence.

   The macro arguments can be in one of the following two forms:

    1. (NAME (ITER &REST ARGS) &BODY BODY)

    2. ((ITER &REST ARGS) &BODY BODY)

   NAME is the block name, NIL if not given.

   ITER is the variable to which the sequence iterator is bound.

   ARGS are the arguments passed to the ITERATOR function, the result
   of which is bound to ITER.

   BODY is the list of forms in the loop body."

  (let-if ((name name/iter)
           (iter (first body) name/iter)
           (body (rest body) body))
      (symbolp name/iter)

    (destructuring-bind (iter &rest args) iter
      `(doiters ,name ((,iter ,@args)) ,@body))))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(ccase nil)

Problem: Macro call that should be transformed by CCASE

Input: (ccase nil)

Output: (defmacro CCASE ...)


Instruction:
Generate a defmacro form that transforms code like this:
(who-ps-html nil nil)

Pattern to recognize: Macro call that should be transformed by WHO-PS-HTML

Input: (who-ps-html nil nil)

Output: (defmacro WHO-PS-HTML ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(scase nil
  nil)

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

Input:
(scase nil
  nil)

Output:
(defmacro scase (keyform &body cases)
  "Like CASE, except binds the keyform to IT (via SYMBOL-MACROLET) for the
scope of the body. IT can be set with SETF."
  `(symbolic case ,keyform ,@cases))


Instruction:
Generate a defmacro form that transforms code like this:
(eval-when-compile
  common-lisp:nil)

Pattern to recognize: Macro call that should be transformed by EVAL-WHEN-COMPILE

Input:
(eval-when-compile
  common-lisp:nil)

Output: (defmacro EVAL-WHEN-COMPILE ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(execute nil :key nil)

Issue: Macro call that should be transformed by EXECUTE

Input: (execute nil :key nil)

Output:
(defmacro execute (query &rest args)
  "Execute a query, ignore the results. So, in effect, like a query called with
format :none. Returns the amount of affected rows as its first returned
value. (Also returns this amount as the second returned value, but use of this
is deprecated.)"
  `(let ((rows (nth-value 1 (query ,query ,@args :none))))
     (if rows (values rows rows) 0)))


Instruction:
Define a macro that eliminates this repetitive pattern:
(when 'lol-gen::some-name)

Issue: Macro call that should be transformed by WHEN

Input: (when 'lol-gen::some-name)

Output: (defmacro WHEN ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(untrace nil)

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

Input: (untrace nil)

Output: (defmacro UNTRACE ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(check-declaration-env nil)

Write a macro that addresses: Macro call that should be transformed by CHECK-DECLARATION-ENV

Input: (check-declaration-env nil)

Output: (defmacro CHECK-DECLARATION-ENV ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(define-language-macro nil)

Problem: Macro call that should be transformed by DEFINE-LANGUAGE-MACRO

Input: (define-language-macro nil)

Output: (defmacro DEFINE-LANGUAGE-MACRO ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(define-script-symbol-macro nil)

Write a macro that addresses: Macro call that should be transformed by DEFINE-SCRIPT-SYMBOL-MACRO

Input: (define-script-symbol-macro nil)

Output: (defmacro DEFINE-SCRIPT-SYMBOL-MACRO ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(group-by nil)

Write a macro that addresses: Macro call that should be transformed by GROUP-BY

Input: (group-by nil)

Output: (defmacro GROUP-BY ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(defun* nil
    (progn))

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

Input:
(defun* nil
    (progn))

Output: (defmacro DEFUN* ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(eval-when-load
  common-lisp:nil
  (common-lisp:progn))

Problem: Macro call that should be transformed by EVAL-WHEN-LOAD

Input:
(eval-when-load
  common-lisp:nil
  (common-lisp:progn))

Output: (defmacro EVAL-WHEN-LOAD ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(gather-result 'lol-gen::some-name)

What needs to change: Macro call that should be transformed by GATHER-RESULT

Input: (gather-result 'lol-gen::some-name)

Output: (defmacro GATHER-RESULT ...)


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(min-of nil)

Write a macro that addresses: Macro call that should be transformed by MIN-OF

Input: (min-of nil)

Output: (defmacro MIN-OF ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(select nil
  (progn))

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

Input:
(select nil
  (progn))

Output:
(defmacro select (fields &body clauses)
  `(make-statement :select
                   ,(match fields
                      ((or (list* (type keyword) _)
                           (list* (list* (type keyword) _) _))
                       `(make-clause :fields
                                     ,@(mapcar #'expand-op fields)))
                      ((type keyword) `(fields ,fields))
                      ((or (type symbol)
                           (list* (type symbol) _))
                       `(convert-if-fields-clause ,fields))
                      (otherwise fields))
                   ,@clauses))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(producing nil (progn))

Problem: Macro call that should be transformed by PRODUCING

Input: (producing nil (progn))

Output: (defmacro PRODUCING ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(with-pp
  nil)

Issue: Macro call that should be transformed by WITH-PP

Input:
(with-pp
  nil)

Output:
(defmacro with-pp (&body body)
  `(symbol-macrolet ((stream (get-stream-generic pp))
		     (indent (get-indent-generic pp))
		     (--indent (dec-indent-generic pp))
		     (++indent (inc-indent-generic pp)))
     (macrolet ((push-sign (x) `(push-sign-generic pp ,x))
		(pop-sign () `(pop-sign-generic pp))
		(top-sign () `(top-sign-generic pp))
		(find-sign (x) `(find-sign-generic pp ,x))
		(push-info (x) `(push-info-generic pp ,x))
		(pop-info () `(pop-info-generic pp))
		(top-info () `(top-info-generic pp))
		(find-info (x) `(find-info-generic pp ,x))
		(info-size () `(info-size-generic pp))
		(node-slot (x) `(slot-value item ',x)))
       ,@body)))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(ctypecase-of nil
    :key
  nil)

Write a macro that addresses: Macro call that should be transformed by CTYPECASE-OF

Input:
(ctypecase-of nil
    :key
  nil)

Output:
(defmacro ctypecase-of (type keyplace &body body &environment env)
  "Like `etypecase-of', but providing a `store-value' restart to correct KEYPLACE and try again."
  (check-exhaustiveness 'typecase type body env)
  `(ctypecase ,keyplace ,@body))


Instruction:
Define a macro that eliminates this repetitive pattern:
(without-symbol-access
  nil
  nil)

Issue: Macro call that should be transformed by WITHOUT-SYMBOL-ACCESS

Input:
(without-symbol-access
  nil
  nil)

Output: (defmacro WITHOUT-SYMBOL-ACCESS ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(class/std nil
  nil)

What needs to change: Macro call that should be transformed by CLASS/STD

Input:
(class/std nil
  nil)

Output:
(defmacro class/std (name &body defaulted-slots)
  "The most concise shortcut macro to DEFCLASS.

  (class/std example slot1 slot2 slot3)

  expands to:

  (DEFCLASS/STD EXAMPLE ()
    ((SLOT1 SLOT2 SLOT3)))

  which expands to:

  (DEFCLASS EXAMPLE ()
    ((SLOT1 :ACCESSOR SLOT1 :INITARG :SLOT1 :INITFORM NIL)
    (SLOT2 :ACCESSOR SLOT2 :INITARG :SLOT2 :INITFORM NIL)
    (SLOT3 :ACCESSOR SLOT3 :INITARG :SLOT3 :INITFORM NIL)))
"
  `(defclass/std ,name ()
     ((,@defaulted-slots))))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(.< common-lisp:nil)

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

Input: (.< common-lisp:nil)

Output:
(defmacro .< (cl:&rest items)
  "Right associative compose operator. Creates a new functions that will run the
functions right to left when applied. This is the same as the `nest` macro without supplying
the value. The composition is thus the same order as `compose`.

`(.< f g h)` creates the function `(fn (x) (f (g (h x))))`."
  (alexandria:with-gensyms (x)
    `(fn (,x)
       (nest ,@items ,x))))