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

Issue: Macro call that should be transformed by NAND

Input: (nand nil (progn))

Output:
(defmacro nand (&rest forms)
  "Equivalent to (not (and ...))."
  (if (null forms) nil
      (if (null (rest forms))
          `(not ,(first forms))
          `(if ,(first forms)
               (nand ,@(rest forms))
               t))))


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

Issue: Macro call that should be transformed by CCASE

Input: (ccase nil :key ())

Output: (defmacro CCASE ...)


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

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

Input:
(dowhile-it nil
  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:
(group-by nil (progn))

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

Input: (group-by nil (progn))

Output: (defmacro GROUP-BY ...)


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

Issue: Macro call that should be transformed by DEFMETHOD*

Input:
(defmethod* nil
    (progn))

Output: (defmacro DEFMETHOD* ...)


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

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

Input: (fail-compile nil (progn))

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


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

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

Input:
(alambda nil
  (progn))

Output:
(defmacro alambda (lambda-list &body body)
  "Like LAMBDA, except that SELF is bound to the resulting function (via LABELS)
within BODY."
  `(labels ((self ,lambda-list ,@body))
     #'self))


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

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

Input:
(etypecase-of nil
    :key
  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:
Define a macro that eliminates this repetitive pattern:
(fgatherlet nil
  nil)

Issue: Macro call that should be transformed by FGATHERLET

Input:
(fgatherlet nil
  nil)

Output: (defmacro FGATHERLET ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(on-duplicate-key-update 'lol-gen::some-name)

Issue: Macro call that should be transformed by ON-DUPLICATE-KEY-UPDATE

Input: (on-duplicate-key-update 'lol-gen::some-name)

Output:
(defmacro on-duplicate-key-update (&rest args)
  `(make-clause :on-duplicate-key-update ,@(mapcar #'expand-op args)))


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

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

Input: (prog* () nil)

Output: (defmacro PROG* ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(group-by nil (progn))

Issue: Macro call that should be transformed by GROUP-BY

Input: (group-by nil (progn))

Output:
(defmacro group-by (&rest expressions)
  `(apply #'make-clause :group-by ',expressions))


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

What needs to change: Macro call that should be transformed by INSERT-INTO

Input:
(insert-into nil
  :key
  nil)

Output:
(defmacro insert-into (table &body clauses)
  `(make-statement :insert-into
                   ,(expand-expression table)
                   ,@(if (and (listp (car clauses))
                              (keywordp (caar clauses)))
                         `(',(car clauses) ,@(cdr clauses))
                         clauses)))


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

Write a macro that addresses: Macro call that should be transformed by DEFINE-SCREAMER-PACKAGE

Input: (define-screamer-package 'lol-gen::some-name)

Output:
(defmacro define-screamer-package (defined-package-name &body options)
  "Convenience wrapper around DEFPACKAGE. Passes its argument directly
to DEFPACKAGE, and automatically injects two additional options:

    \(:shadowing-import-from :screamer :defun :multiple-value-bind :y-or-n-p)
    \(:use :cl :screamer)"
  `(defpackage ,defined-package-name
     ,@options
     (:shadowing-import-from :screamer :defun :multiple-value-bind :y-or-n-p)
     (:use :cl :screamer)))


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

Write a macro that addresses: Macro call that should be transformed by EVAL-WHEN-LOAD

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

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


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

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

Input:
(match nil
    nil)

Output:
(defmacro match (adt obj &body clauses)
  "Perform pattern matching on OBJ with (adt-type) ADT.

Each clause must have the following syntax:

<var> := <symbol> | '_'
<lhs> := '_'
       | (<symbol> <var>*)
<clause> := (<lhs> <lisp code>)

The symbol '_' denotes a wildcard, as well as a fallthough.

Note that pattern matching is only shallow (patterns are one-level
deep).
"
  (assert (symbolp adt)
          (adt)
          "MATCH requires a symbol for the first argument. Given ~S."
          adt)

  (let ((ctors (mapcar #'car (get-constructors adt)))
        (types (mapcar (lambda (clause)
                         (ensure-car (car clause)))
                       clauses))
        (once (gensym "OBJ-")))

    ;; Check for duplicate matches.
    (let ((dupes (duplicates types)))
      (when dupes
        (warn "Duplicate matching clauses exist. Duplicate pattern ~
               constructors:~{ ~S~}"
              dupes)))

    ;; Check for match exhaustiveness.
    (unless (some #'wild? types)
      (let ((diff (set-difference ctors types)))
        (when diff
          (warn "Non-exhaustive match on ~A data ~
                 type. Missing cases:~{ ~S~}" adt diff))))

    ;; Generate the matching code.
    `(let ((,once ,obj))
       (check-type ,once ,adt)
       (etypecase ,once
         ,@(loop :for (bindings . body) :in clauses
                 :collect (let ((type (ensure-car bindings)))
                            (if (wild? type)
                                `(t ,@body)
                                `(,type
                                  (with-data ,(ensure-list bindings)
                                             ,once
                                    ,@body)))))))))


Instruction:
Define a macro that eliminates this repetitive pattern:
(modf-eval nil (progn))

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

Input: (modf-eval nil (progn))

Output:
(defmacro modf-eval (&rest args)
  `(progn ,@args))


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

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

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

Output:
(defmacro lambda-ematch1 (pattern &body body)
  "Equivalent to (lambda (arg) (ematch arg (PATTERN BODY...)))."
  `(lambda-ematch (,pattern ,@body)))


Instruction:
Generate a defmacro form that transforms code like this:
(string-literal nil)

Pattern to recognize: Macro call that should be transformed by STRING-LITERAL

Input: (string-literal nil)

Output: (defmacro STRING-LITERAL ...)


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

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

Input: (in-package nil)

Output: (defmacro IN-PACKAGE ...)


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

Write a macro that addresses: Macro call that should be transformed by DYNAMIC-WIND

Input:
(dynamic-wind
  nil
  nil)

Output: (defmacro DYNAMIC-WIND ...)


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

Problem: Macro call that should be transformed by CHAR-ECASE

Input:
(char-ecase nil
  (progn))

Output:
(defmacro char-ecase (keyform &body clauses)
  "Like `ecase', but specifically for characters.
Expands into `tree-case'."
  `(char-ecase-1 ,keyform
     ,@(expand-char-case-keys clauses)))


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

Problem: Macro call that should be transformed by IS

Input: (is nil nil)

Output:
(defmacro is (got expected &rest args)
  (with-gensyms (duration result new-args desc)
    (once-only (expected)
      `(let* ((,new-args (list ,@args))
              (,desc (parse-description-and-test ,new-args)))
         (with-catching-errors (:description ,desc :expected ,expected)
           (with-duration ((,duration ,result) ,got)
             (test ,result ,expected ,new-args
                   :duration ,duration)))))))


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

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

Input: (callf nil nil)

Output:
(defmacro callf (function place &rest args &environment env)
  "Set PLACE to the value of calling FUNCTION on PLACE, with ARGS."
  (multiple-value-bind (vars vals stores setter getter)
      (get-setf-expansion place env)
    `(let* ,(mapcar #'list vars vals)
       (multiple-value-bind ,stores
           (funcall ,function ,getter ,@args)
         ,setter))))


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

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

Input:
(aecase nil
  :key
  nil)

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


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

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

Input: (-<>> nil)

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


Instruction:
Generate a defmacro form that transforms code like this:
(make-simple-appender-to-place 'lol-gen::some-name)

Pattern to recognize: Macro call that should be transformed by MAKE-SIMPLE-APPENDER-TO-PLACE

Input: (make-simple-appender-to-place 'lol-gen::some-name)

Output: (defmacro MAKE-SIMPLE-APPENDER-TO-PLACE ...)


Instruction:
Generate a defmacro form that transforms code like this:
(f-zerop nil nil)

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

Input: (f-zerop nil nil)

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


Instruction:
Generate a defmacro form that transforms code like this:
(enable-interpol-syntax)

Pattern to recognize: Macro call that should be transformed by ENABLE-INTERPOL-SYNTAX

Input: (enable-interpol-syntax)

Output:
(defmacro enable-interpol-syntax (&rest %enable-interpol-syntax-args)
  "Enable CL-INTERPOL reader syntax."
  `(eval-when (:compile-toplevel :load-toplevel :execute)
    (%enable-interpol-syntax ,@%enable-interpol-syntax-args)))


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

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

Input: (some-> nil)

Output: (defmacro SOME-> ...)


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

Issue: Macro call that should be transformed by ->

Input: (-> nil (progn))

Output: (defmacro -> ...)


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

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

Input: (and-it 'lol-gen::some-name)

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:
Generate a defmacro form that transforms code like this:
(c?n)

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

Input: (c?n)

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


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

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

Input: (returning)

Output: (defmacro RETURNING ...)


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

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

Input:
(selector nil
    nil)

Output: (defmacro SELECTOR ...)


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

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

Input: (trc nil)

Output:
(defmacro trc (tgt-form &rest os)
  (if (eql tgt-form 'nil)
      '(progn)
    (if (stringp tgt-form)
        `(without-c-dependency
          (call-trc t ,tgt-form ,@os))
      (let ((tgt (gensym)))
        ;(break "slowww? ~a" tgt-form)
        `(without-c-dependency
          (bif (,tgt ,tgt-form)
            (if (trcp ,tgt)
                (progn
                  (assert (stringp ,(car os)) () "trc with test expected string second, got ~a" ,(car os))
                  (call-trc t ,@os)) ;;,(car os) ,tgt ,@(cdr os)))
              (progn
                ;(trc "trcfailed")
                (count-it :trcfailed)))
            (count-it :tgtnileval)))))))


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

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

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

Output: (defmacro -<>> (init &body exps) (diamond-wand init exps t))


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

Problem: Macro call that should be transformed by CHARACTER-LITERAL

Input: (character-literal nil)

Output: (defmacro CHARACTER-LITERAL ...)


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

Issue: Macro call that should be transformed by C_IN

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

Output:
(defmacro c_in (&body body)
  `(c-input (:lazy :once-asked) (progn ,@body)))


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

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

Input:
(jmatch nil
  nil)

Output:
(defmacro jmatch (form &body clauses)
  "Similar to Trivia match macro, match the FORM (JSON value) against CLAUSES.
CLAUSES are (PATTERN . BODY) forms, where
- PATTERN is a `jbind' destructuring pattern.
- And BODY is an implicit progn.

If PATTERN matches successfully in `jbind', then BODY is executed with
the variables from the PATTERN bound to the respective values, as per
`jbind'.

The last clause could start with T, OTHERWISE, ELSE, or _, and it will
be invoked if other patterns don't match. If there's no such clause,
`jmatch' will simply return NIL on no matching patterns."
  (let ((form-sym (gensym "MATCH-FORM")))
    `(let ((,form-sym ,form))
       (cond
         ,@(loop for (pattern . body) in clauses
                 when (and (symbolp pattern)
                           (member (symbol-name pattern) '("T" "_" "OTHERWISE" "ELSE")
                                   :test #'string=))
                   collect `(t ,@body)
                 else
                   collect `((ignore-errors (jbind ,pattern ,form-sym t))
                             (jbind ,pattern ,form-sym ,@body)))))))


Instruction:
Generate a defmacro form that transforms code like this:
(matrix-typecase nil)

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

Input: (matrix-typecase nil)

Output: (defmacro MATRIX-TYPECASE ...)


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

What needs to change: Macro call that should be transformed by DISTINCT-ON

Input: (distinct-on nil :key nil)

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


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

Problem: Macro call that should be transformed by ACTYPECASE

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

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:
You are a Common Lisp macro expert. Given this code pattern:
(modf-fn nil)

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

Input: (modf-fn nil)

Output:
(defmacro modf-fn (symbol)
  "Expand to the defined Modf function.  Basically, \(MODF-FN SYM) is the
functional analog of #'\(SETF SYM)."
  `(function ,(intern (modf-name symbol) :modf)))


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

Problem: Macro call that should be transformed by LET-MATCH*

Input:
(let-match* common-lisp:nil
  :key
  common-lisp:nil)

Output:
(defmacro let-match* (bindings &body body)
  "Similar to LET-MATCH but matches sequentially."
  (reduce (lambda (binding form) `(let-match (,binding) ,form))
          bindings
          :from-end t
          :initial-value `(locally ,.body)))


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

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

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

Output:
(defmacro jand (&rest args)
  "JSON-aware version of `cl:and'."
  `(and ,@(loop for arg in args
                collecting `(jwhen ,arg ,arg))))


Instruction:
Define a macro that eliminates this repetitive pattern:
(with-active-layers* 'lol-gen::some-name)

Issue: Macro call that should be transformed by WITH-ACTIVE-LAYERS*

Input: (with-active-layers* 'lol-gen::some-name)

Output: (defmacro WITH-ACTIVE-LAYERS* ...)


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

Problem: Macro call that should be transformed by DEFCLAUSE-SEQUENCE

Input: (defclause-sequence nil nil)

Output:
(defmacro defclause-sequence (element-name index-name
                              &key access-fn size-fn
                              element-type sequence-type
                              element-doc-string index-doc-string)
  "A simple way to define a FOR-like &sequence clause."

;Package subtlety: FOR should be in the same package as the
;element-name or index-name."
  (let* ((seq-for (when element-name
                    (intern (symbol-name 'for) (symbol-package element-name))))
         (seq-def (when element-name
                    `(defclause-driver
                         (,seq-for var ,element-name seq &sequence)
                       ,element-doc-string
                       (return-sequence-code :element-var var
                                             :sequence seq
                                             :access-fn ,access-fn
                                             :size-fn ,size-fn
                                             :element-type  ,element-type
                                             :sequence-type ,sequence-type))))
         #+nil
         (inx-for (when index-name
                    (intern (symbol-name 'for) (symbol-package index-name))))
         (inx-def (when index-name
                    `(defclause-driver (:for var ,index-name seq &sequence)
                       ,index-doc-string
                       (if with-index
                           (clause-error "WITH-INDEX keyword should not ~
be specified for this clause")
                           (progn
                             (setq with-index var)
                             (return-sequence-code
                              :sequence seq
                              :size-fn ,size-fn
                              :sequence-type ,sequence-type)))))))
    `(progn ,seq-def ,inx-def)))


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

What needs to change: Macro call that should be transformed by DEFWALKER-HANDLER

Input:
(defwalker-handler nil
  (progn))

Output: (defmacro DEFWALKER-HANDLER ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(without-dependency-capture
  nil)

Issue: Macro call that should be transformed by WITHOUT-DEPENDENCY-CAPTURE

Input:
(without-dependency-capture
  nil)

Output: (defmacro WITHOUT-DEPENDENCY-CAPTURE ...)


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

Issue: Macro call that should be transformed by SELECT

Input:
(select nil
  (progn))

Output:
(defmacro select (keyform &body clauses)
  "Like `case', but with evaluated keys.

Note that, like `case', `select' interprets a list as the first
element of a clause as a list of keys. To use a form as a key, you
must add an extra set of parentheses.

     (select 2
       ((+ 2 2) t))
     => T

     (select 4
       (((+ 2 2)) t))
     => T

From Zetalisp."
  `(selector ,keyform eql
     ,@clauses))


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

Issue: Macro call that should be transformed by DEFINE-LAYERED-CLASS

Input: (define-layered-class 'lol-gen::some-name)

Output: (defmacro DEFINE-LAYERED-CLASS ...)


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

Problem: Macro call that should be transformed by IF-LET

Input:
(if-let nil
  (progn))

Output:
(defmacro if-let (bindings &body (then-form &optional else-form))
    "Creates new variable bindings, and conditionally executes either
THEN-FORM or ELSE-FORM. ELSE-FORM defaults to NIL.

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

All initial-forms are executed sequentially in the specified order. Then all
the variables are bound to the corresponding values.

If all variables were bound to true values, the THEN-FORM is executed with the
bindings in effect, otherwise the ELSE-FORM is executed with the bindings in
effect."
    (let* ((binding-list (if (and (consp bindings) (symbolp (car bindings)))
                             (list bindings)
                             bindings))
         (variables (mapcar #'car binding-list)))
    `(let ,binding-list
       (if (and ,@variables)
           ,then-form
           ,else-form))))


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

Problem: Macro call that should be transformed by C-ABS

Input:
(c-abs nil
  (progn))

Output:
(defmacro c-abs (value &body body)
  `(make-c-drifter-absolute
    :code ',body
    :value-state :valid
    :value ,value
    :rule (c-lambda ,@body)))


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(lexpr-$send nil (progn))

Write a macro that addresses: Macro call that should be transformed by LEXPR-$SEND

Input: (lexpr-$send nil (progn))

Output: (defmacro LEXPR-$SEND ...)


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

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

Input:
(with-yield
  nil
  :key
  nil)

Output: (defmacro WITH-YIELD ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(collect-at-end nil :key nil)

Issue: Macro call that should be transformed by COLLECT-AT-END

Input: (collect-at-end nil :key nil)

Output: (defmacro COLLECT-AT-END ...)


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

Pattern to recognize: Macro call that should be transformed by FM!V

Input: (fm!v 'lol-gen::some-name)

Output:
(defmacro fm!v (id)
  `(value (fm! ,id)))


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 ->* ...)


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

What needs to change: Macro call that should be transformed by PRINT-OBJECT/STD

Input: (print-object/std 'lol-gen::some-name)

Output:
(defmacro print-object/std (class)
  "Old name for DEFINE-PRINT-OBJECT/STD."
  `(define-print-object/std ,class))


Instruction:
Generate a defmacro form that transforms code like this:
(define-stealth-mixin nil :key nil)

Pattern to recognize: Macro call that should be transformed by DEFINE-STEALTH-MIXIN

Input: (define-stealth-mixin nil :key nil)

Output: (defmacro DEFINE-STEALTH-MIXIN ...)


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

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

Input:
(aprog1 nil
  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:
Generate a defmacro form that transforms code like this:
(with-open-files 'lol-gen::some-name)

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

Input: (with-open-files 'lol-gen::some-name)

Output:
(defmacro with-open-files ((&rest args) &body body)
  "A simple macro to open one or more files providing the streams for the BODY. The ARGS is a list of `(stream filespec options*)` as supplied to WITH-OPEN-FILE."
  (case (length args)
    ((0)
     `(progn ,@body))
    ((1)
     `(with-open-file ,(first args) ,@body))
    (t `(with-open-file ,(first args)
          (with-open-files
              ,(rest args) ,@body)))))


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

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

Input: (order-by nil :key nil)

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


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

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

Input:
(with-pp
  nil
  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:
Write a Common Lisp macro to handle this code pattern:
(define-fixture-capture nil
    nil)

Problem: Macro call that should be transformed by DEFINE-FIXTURE-CAPTURE

Input:
(define-fixture-capture nil
    nil)

Output:
(defmacro define-fixture-capture (name args &body body)
  `(progn (setf (gethash ',name *fixture-captures*)
                (lambda ,args ,@body))
          ',name))


Instruction:
Define a macro that eliminates this repetitive pattern:
(def-kid-slots nil)

Issue: Macro call that should be transformed by DEF-KID-SLOTS

Input: (def-kid-slots nil)

Output:
(defmacro def-kid-slots (&rest slot-defs)
  `(lambda (self)
     (declare (ignorable self))
     (list ,@slot-defs)))


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

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

Input: ($slot 'lol-gen::some-name)

Output: (defmacro $SLOT ...)


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

Issue: Macro call that should be transformed by LISTCASE

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

Output:
(defmacro listcase (list &body cases)
  "A typecase-like macro to destinguish between 3 possible kinds of LIST:
   simple lists, alists, and dlists.
   Evaluates the appropriate key-form depending on the kind:
   ALIST, DLIST or simple list (T)."
  (once-only (list)
    `(if (consp (first ,list))
         (cond ((consp (second ,list))
                (progn ,@(assoc1 'alist cases)))
               ((second ,list)
                (progn ,@(assoc1 'dlist cases)))
               (t
                (progn ,@(assoc1 't cases))))
         (progn ,@(assoc1 't cases)))))


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

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

Input:
(jbind nil
    :key
  nil)

Output:
(defmacro jbind (destructuring-pattern form &body body)
  "Match the FORM against DESTRUCTURING-PATTERN.
The pattern might be:
- A symbol, in which case the current chosen form is bound to it. If
  the symbol is _, simply skip the form.
- A literal form:
  - String or number: compare with `equal'.
  - Keywords :TRUE, :FALSE, and :NULL, matching T, NIL, and :NULL
    respectively.
- If the pattern is a property list of string+pattern pairs, match the
  string+pattern pairs inside it to the provided JSON object and
  resolve them recursively.
- If the pattern is a list of symbols (VAR &optional VAR-P), these are
  bound to the respective values of `jget'. It is a good way to make
  `jbind' to be more lenient to missing keys, because the default
  behavior is to error on missing data.
- If the pattern is an inline vector, match it against a JSON array
  with at least as many elements as provided in the vector. Match
  every form in the vector against the element with the same index.

If the DESTRUCTURING-PATTERN doesn't match the object, throw
`value-mismatch'.

Underlying `jget' can throw errors for the exceptionally malformed
inputs. See `jget' documentation for the types of errors it throws.

Example:
\(\"hello\" hello \"a\" _ \"b\" b
 \"array\" #(first second third _))

matches a JSON object
{\"hello\": 3, \"a\": 8, \"b\": 3, \"c\": null, \"array\": [1, 2, 3, 4]}

and binds
- HELLO to 3
- B to 3
- FIRST to 1
- SECOND to 2
- THIRD to 3

It also checks that \"a\" key is present in the object and there's a
fourth element in the nested array.

See more examples in njson tests."
  (let ((form-sym (gensym "BIND-FORM"))
        (bindings (list)))
    (labels ((parse-pattern (pattern &optional (current-path (list)))
               (etypecase pattern
                 ((or (member :true :false :null) string real)
                  (push (cons pattern (copy-list current-path))
                        bindings))
                 ((cons symbol *)
                  (push (cons pattern (copy-list current-path))
                        bindings))
                 (list
                  (loop for (key subpattern) on pattern by #'cddr
                        do (parse-pattern subpattern (append current-path (list key))))
                  (push (cons nil (copy-list current-path))
                        bindings))
                 ((and symbol (not keyword))
                  (push (cons (if (equal "_" (symbol-name pattern))
                                  (gensym "_PATTERN")
                                  pattern)
                              (copy-list current-path))
                        bindings))
                 (array
		  (loop for elem across pattern
                        for index from 0
                        do (parse-pattern elem (append current-path (list index))))
		  (push (cons #() (copy-list current-path))
			bindings)))))
      (check-type destructuring-pattern (or list (and array (not string))
                                            (and symbol (not keyword)))
                  "proper jbind destructuring pattern: list, array, or symbol")
      (parse-pattern destructuring-pattern)
      (let ((let-forms (loop for (binding . key) in bindings
                             do (check-type binding (or array real symbol
                                                        ;; For (VAR VAR-P) forms
                                                        (cons symbol (or (cons symbol null)
                                                                         null))))
                             if (typep binding '(or array real null
                                                 (member :true :false :null)))
                               collect `(,(gensym) (check-value ,binding (vector ,@key) ,form-sym))
                             else if (and (symbolp binding)
                                          (uiop:emptyp key))
                                    collect `(,binding ,form-sym)
                             else if (listp binding)
                                    append (destructuring-bind (var &optional (var-p nil var-p-provided))
                                               binding
                                             (append
                                              `((,var (jget (vector ,@key) ,form-sym)))
                                              (when var-p-provided
                                                `((,var-p (nth-value 1 (jget (vector ,@key) ,form-sym)))))))
                             else
                               collect `(,binding (check-value t (vector ,@key) ,form-sym)))))
        `(let* ((,form-sym ,form)
                ,@let-forms)
           (declare (ignorable ,form-sym ,@(mapcar #'first let-forms)))
           ,@body))))


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

Problem: Macro call that should be transformed by ODIG

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

Output: (defmacro ODIG ...)


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

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

Input: (ensure2 nil)

Output:
(defmacro ensure2 (place &body newval &environment env)
  "Like `ensure', but specifically for accessors that return a second
value like `gethash'."
  (multiple-value-bind (vars vals stores setter getter)
      (get-setf-expansion place env)
    (with-gensyms (old presentp)
      `(let* ,(mapcar #'list vars vals)
         (multiple-value-bind (,old ,presentp)
             ,getter
           (if ,presentp
               ,old
               (multiple-value-bind ,stores
                   (progn ,@newval)
                 ,setter)))))))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(with-decoder-simple-list-semantics
  nil
  :key
  nil)

Problem: Macro call that should be transformed by WITH-DECODER-SIMPLE-LIST-SEMANTICS

Input:
(with-decoder-simple-list-semantics
  nil
  :key
  nil)

Output:
(defmacro with-decoder-simple-list-semantics (&body body)
  "Execute BODY in a dynamic environement where the decoder semantics
is such as set by SET-DECODER-SIMPLE-LIST-SEMANTICS."
  `(with-shadowed-custom-vars
     (set-decoder-simple-list-semantics)
     ,@body))


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

Pattern to recognize: Macro call that should be transformed by 2ND

Input: (2nd nil)

Output:
(defmacro 2nd (form)
  "(NTH-VALUE 1 FORM)"
  `(nth-value 1 ,form))


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

Issue: Macro call that should be transformed by ->

Input:
(-> nil
  (progn))

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


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

What needs to change: Macro call that should be transformed by DEFMACRO-DRIVER

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

Output:
(defmacro defmacro-driver (clause-template &body body)
  "Macro for for defining iterators (with DEFMACRO), which may also be used
as generators."
  (define-clause 'defmacro clause-template body t))


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

Problem: Macro call that should be transformed by ENSURE-LIST

Input: (ensure-list nil)

Output:
(defmacro ensure-list (item &body body)
  `(let ((,item (if (listp ,item) ,item '(,item))))
     ,@body))


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

Pattern to recognize: Macro call that should be transformed by DO*

Input: (do* () (progn))

Output: (defmacro DO* ...)


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

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

Input: (html5 nil)

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


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

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

Input: (collect-nth nil (progn))

Output: (defmacro COLLECT-NTH ...)


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

Issue: Macro call that should be transformed by COLLECT-IGNORE

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

Output: (defmacro COLLECT-IGNORE ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(with-read-only-vars nil)

Issue: Macro call that should be transformed by WITH-READ-ONLY-VARS

Input: (with-read-only-vars nil)

Output:
(defmacro with-read-only-vars ((&rest vars) &body body &environment env)
  "Make VARS read-only within BODY.

That is, within BODY, each var in VARS is bound as a symbol macro,
which expands into a macro whose setf expander, in turn, is defined to
signal a warning at compile time, and an error at run time.

Depending on your Lisp implementation this may or may not do anything,
and may or may not have an effect when used on special variables."
  (declare (ignorable env))
  (case uiop:*implementation-type*
    ((:ccl :sbcl :cmu :acl)
     ;; The use of temps here, while it is ugly and annoying when
     ;; debugging, is necessary to prevent symbol-macrolet from going
     ;; into an infinite loop.
     (let* ((vars (loop for var in vars
                        unless (variable-special? var env)
                          collect var))
            (temps
              (loop for var in vars
                    collect (gensym (string var)))))
       `(let ,(mapcar #'list temps vars)
          (declare (ignorable ,@temps))
          (symbol-macrolet ,(loop for var in vars
                                  for temp in temps
                                  collect `(,var (read-only-var ,temp ,var)))
            ,@body))))
    (t
     `(locally ,@body))))


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

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

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

Output:
(defmacro ignoring (type &body body)
  "DEPRECATED: use `alexandria:ignore-some-conditions' instead."
  (simple-style-warning "~s is deprecated, use ~s instead"
                        'ignoring 'ignore-some-conditions)
  `(ignore-some-conditions (,type)
     ,@body))


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


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

Problem: Macro call that should be transformed by WHILE

Input:
(while nil
  :key
  nil)

Output: (defmacro WHILE ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(defunwalker-handler nil
    (progn))

Issue: Macro call that should be transformed by DEFUNWALKER-HANDLER

Input:
(defunwalker-handler nil
    (progn))

Output: (defmacro DEFUNWALKER-HANDLER ...)


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

Problem: Macro call that should be transformed by SUBTEST

Input:
(subtest nil
  :key
  nil)

Output:
(defmacro subtest (desc &body body)
  `(%subtest ,desc (lambda () ,@body)))


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(def-metadata-infer nil
    :key
    nil)

What needs to change: Macro call that should be transformed by DEF-METADATA-INFER

Input:
(def-metadata-infer nil
    :key
    nil)

Output:
(defmacro def-metadata-infer (varjo-type-spec metadata-kind env-var &body body)
  (warn 'v-deprecated
        :old 'def-metadata-infer
        :new 'define-metadata-infer)
  `(define-metadata-infer ,varjo-type-spec ,metadata-kind ,env-var ,@body))


Instruction:
Write a Common Lisp macro to handle this code pattern:
(multiple-value-prog2 nil
    :key
  nil)

Problem: Macro call that should be transformed by MULTIPLE-VALUE-PROG2

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

Output:
(defmacro multiple-value-prog2 (first-form second-form &body forms)
  "Evaluates FIRST-FORM, then SECOND-FORM, and then FORMS. Yields as its value
all the value returned by SECOND-FORM."
  `(progn ,first-form (multiple-value-prog1 ,second-form ,@forms)))


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

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

Input:
(resolving
  nil
  nil)

Output: (defmacro RESOLVING ...)


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

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

Input: (dreletf* nil)

Output: (defmacro DRELETF* ...)


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

Problem: Macro call that should be transformed by EMATCH

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

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


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

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

Input: (sccase nil)

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


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

Problem: Macro call that should be transformed by DEFPRETTYMETHOD

Input:
(defprettymethod nil
    nil)

Output:
(defmacro defprettymethod (qualifier node &body body)
  (if (eql :self qualifier)
      `(progn (setf (gethash (find-class ',node) *ignore-node*) t)
	      (defmethod traverser
		  ((pp pretty-printer)
		   (item ,node) level)
		(declare (ignorable level))
		(with-slots (values subnodes) item .,body)
		(call-next-method)))
      `(defmethod traverser ,qualifier
	 ((pp pretty-printer)
	  (item ,node) level)
	 (declare (ignorable level))
	 (with-slots (values subnodes) item .,body))))


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

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

Input: (cmatch* common-lisp:nil)

Output:
(defmacro cmatch* (whats &body clauses)
  #.+match*-doc+
  (let ((temps (make-gensyms whats "OTHERWISE")))
    `(match2* ,whats
       ,@clauses
       (,temps
        (cerror "continue" 'match-error :pattern ',clauses :values (list ,@temps))))))


Instruction:
Generate a defmacro form that transforms code like this:
(ltbdd-with-new-hash nil
  nil)

Pattern to recognize: Macro call that should be transformed by LTBDD-WITH-NEW-HASH

Input:
(ltbdd-with-new-hash nil
  nil)

Output: (defmacro LTBDD-WITH-NEW-HASH ...)


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

Problem: Macro call that should be transformed by JAND

Input: (jand nil :key nil)

Output:
(defmacro jand (&rest args)
  "JSON-aware version of `cl:and'."
  `(and ,@(loop for arg in args
                collecting `(jwhen ,arg ,arg))))


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

Issue: Macro call that should be transformed by DELETEF

Input: (deletef nil nil)

Output: (defmacro DELETEF ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(and-it)

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

Input: (and-it)

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:
Generate a defmacro form that transforms code like this:
(v-defmacro nil
    :key
  nil)

Pattern to recognize: Macro call that should be transformed by V-DEFMACRO

Input:
(v-defmacro nil
    :key
  nil)

Output:
(defmacro v-defmacro (name lambda-list &body body)
  `(define-vari-macro ,name ,lambda-list ,@body))


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

Issue: Macro call that should be transformed by SKIP

Input: (skip nil)

Output:
(defmacro skip (desc &body tests)
  `(with-forced-status (:skipped ,@(if (listp desc) desc (list desc)))
     ,@tests))


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

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

Input: (defun nil :key nil)

Output: (defmacro DEFUN ...)


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

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

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

Output: (defmacro MATCH ...)


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

Issue: Macro call that should be transformed by LIVE

Input: (live)

Output:
(defmacro live (&body forms)
  "Define a live block consisting of FORMS.

The FORMS are evaluated once when the LIVE form is first evaluated,
after which they are evaluated again whenever the values of the cells
referenced by them change. Cells may be referenced either directly in
FORMS or by a function called during the evaluation of FORMS.

Returns a function which when called, stops the live block. Once
stopped the live block will no longer be called when the values of the
referenced cells change."

  (let ((spec (make-instance 'watch-function-spec :body forms)))
    (generate-watch-function spec)))


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

Problem: Macro call that should be transformed by DEFCONST

Input: (defconst nil (progn))

Output:
(defmacro defconst (symbol init &optional docstring)
  "Define a constant, lexically.

`defconst' defines a constant using a strategy similar to `def', so
you don’t have to +cage+ your constants.

The constant is only redefined on re-evaluation if INIT has a
different literal representation than the old value.

A constant defined with `defconst' is guaranteed to be available as
soon as it has been defined (for example, for use with reader macros
later in the same file). This is not guaranteed to be portably true
for `defconstant'.

The name is from Emacs Lisp."
  (let ((backing-var (symbolicate '#:+storage-for-deflex-var- symbol '+)))
    `(eval-when (:compile-toplevel :load-toplevel :execute)
       (define-constant ,backing-var ,init
         :test 'same-literal-p
         :documentation ,docstring)
       (define-symbol-macro ,symbol ,backing-var))))


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

Issue: Macro call that should be transformed by DLETF

Input:
(dletf nil
  :key
  nil)

Output: (defmacro DLETF ...)


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

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

Input: (xml nil (progn))

Output:
(defmacro xml (&rest tags)
  `(with-doctype :xml
     (loop for tag in ',tags
           append (tag->string tag))))


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

Problem: Macro call that should be transformed by BIND

Input:
(bind nil
  :key
  nil)

Output:
(defmacro bind ((&rest bindings) &body body)
  "Bind variables from BINDINGS to be active inside BODY, as if by LET*,
combined with MULTIPLE-VALUE-BIND, DESTRUCTURING-BIND and other -bind forms,
depending on the type of the first argument."
  (let ((rez body))
    (dolist (binding (reverse bindings))
      (setf rez `((,@(funcall #'expand-binding binding rez)))))
    (first rez)))


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

Write a macro that addresses: Macro call that should be transformed by CELL-LET

Input:
(cell-let nil
  nil)

Output:
(defmacro cell-let ((&rest bindings) &body body &environment env)
  "Define cells that are visible only to the forms in BODY.

BINDINGS is a list of cell bindings to establish, similar to
LET*. Each item in BINDINGS is a list of the form

.. code-block::

   (NAME VALUE-FORM)

where NAME is the symbol identifying the cell and VALUE-FORM is the
value form of the cell. The cell can then be referenced within the
forms in BODY by the symbol NAME.

The cells defined in BINDINGS lexcially shadow those in the
environment defined with DEFCELL or by an enclosing CELL-LET
form. Like LET* and unlike LET, each cell definition may reference the
cells defined earlier in the same CELL-LET.

The forms in BODY are evaluated in an implicit PROGN. The value
returned by the last form is returned by the CELL-LET form."

  (flet ((make-cell-binding (binding form)
           (destructuring-bind (name &optional initform)
               (ensure-list binding)

             (if (constantp initform env)
                 `(mutable-cell-let% (,name ,initform) ,form)
                 `(computed-cell-let% (,name ,initform) ,form)))))

    (->> `(progn ,@body)
         (reduce #'make-cell-binding bindings :from-end t :initial-value))))


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

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

Input: (js)

Output: (defmacro JS ...)


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

Issue: Macro call that should be transformed by ENABLE-INTERPOL-SYNTAX

Input: (enable-interpol-syntax 'lol-gen::some-name)

Output:
(defmacro enable-interpol-syntax (&rest %enable-interpol-syntax-args)
  "Enable CL-INTERPOL reader syntax."
  `(eval-when (:compile-toplevel :load-toplevel :execute)
    (%enable-interpol-syntax ,@%enable-interpol-syntax-args)))


Instruction:
Define a macro that eliminates this repetitive pattern:
(with-decoder-simple-list-semantics
  nil
  (progn))

Issue: Macro call that should be transformed by WITH-DECODER-SIMPLE-LIST-SEMANTICS

Input:
(with-decoder-simple-list-semantics
  nil
  (progn))

Output:
(defmacro with-decoder-simple-list-semantics (&body body)
  "Execute BODY in a dynamic environement where the decoder semantics
is such as set by SET-DECODER-SIMPLE-LIST-SEMANTICS."
  `(with-shadowed-custom-vars
     (set-decoder-simple-list-semantics)
     ,@body))


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

Write a macro that addresses: Macro call that should be transformed by C?DBG

Input:
(c?dbg
  nil
  nil)

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


Instruction:
Write a Common Lisp macro to handle this code pattern:
(let-match* common-lisp:nil)

Problem: Macro call that should be transformed by LET-MATCH*

Input: (let-match* common-lisp:nil)

Output:
(defmacro let-match* (bindings &body body)
  "Similar to LET-MATCH but matches sequentially."
  (reduce (lambda (binding form) `(let-match (,binding) ,form))
          bindings
          :from-end t
          :initial-value `(locally ,.body)))


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

What needs to change: Macro call that should be transformed by PS-HTML

Input: (ps-html nil)

Output: (defmacro PS-HTML ...)


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

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

Input: (appendf nil)

Output: (defmacro APPENDF ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(left-join nil)

Issue: Macro call that should be transformed by LEFT-JOIN

Input: (left-join nil)

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


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

What needs to change: Macro call that should be transformed by WITH-HTML-OUTPUT-TO-STRING

Input: (with-html-output-to-string 'lol-gen::some-name)

Output:
(defmacro with-html-output-to-string ((var &optional string-form
                                       &key
                                         (element-type #-:lispworks ''character
                                                       #+:lispworks ''lw:simple-char)
                                         prologue
                                         indent)
                                      &body body)
  "Transform the enclosed BODY consisting of HTML as s-expressions
into Lisp code which creates the corresponding HTML as a string."
  (multiple-value-bind (declarations forms) (extract-declarations body)
    `(with-output-to-string (,var ,string-form :element-type ,element-type)
       ,@declarations
       (with-html-output (,var nil :prologue ,prologue :indent ,indent)
         ,@forms))))


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

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

Input: (export-only-always nil)

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


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

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

Input: (with-transaction nil)

Output:
(defmacro with-transaction ((&optional name isolation-level) &body body)
  "Execute the given body within a database transaction, committing it when the
body exits normally, and aborting otherwise. An optional name and/or
isolation-level can be given to the transaction. The name can be used to force
a commit or abort before the body unwinds. The isolation-level will set the
isolation-level used by the transaction.

You can specify the following isolation levels in postmodern transactions:

- :read-committed-rw (read committed with read and write)
- :read-committed-ro (read committed with read only)
- :repeatable-read-rw (repeatable read with read and write)
- :repeatable-read-ro (repeatable read with read only)
- :serializable (serializable with reand and write)

Sample usage where george is just the name given to the transaction (not quoted
or a string) and ... simply indicates other statements would be expected here:

    (with-transaction ()
      (execute (:insert-into 'test-data :set 'value 77))
      ...)

    (with-transaction (george)
      (execute (:insert-into 'test-data :set 'value 22))
      ...)

    (with-transaction (george :read-committed-rw)
      (execute (:insert-into 'test-data :set 'value 33))
      (query (:select '* :from 'test-data))
      ...)

    (with-transaction (:serializable)
      (execute (:insert-into 'test-data :set 'value 44))
      ...)

Further discussion of transactions and isolation levels can found in the
isolation notes file in the doc folder."
  (let ((transaction-name (or (when (not (isolation-level-p name))
                                name)
                              (gensym "anonymous-transaction"))))
    (when (and name (isolation-level-p name))
      (setf isolation-level name))
    `(call-with-transaction (lambda (,transaction-name)
                              (declare (ignorable ,transaction-name)) ,@body)
                            ,isolation-level)))


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

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

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

Output: (defmacro DOWHILE-BIND ...)


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

Issue: Macro call that should be transformed by FINDING

Input: (finding nil (progn))

Output: (defmacro FINDING ...)


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

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

Input: (-<> nil nil)

Output: (defmacro -<> ...)


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

Issue: Macro call that should be transformed by LAMBDA

Input: (lambda () :key nil)

Output: (defmacro LAMBDA ...)


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

What needs to change: Macro call that should be transformed by KEEP-BOPS

Input: (keep-bops nil (progn))

Output: (defmacro KEEP-BOPS ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(with-contracts-enabled nil
  :key
  nil)

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

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

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:
Create a Common Lisp macro for the following transformation. Before code:
(fail nil :key nil)

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

Input: (fail nil :key nil)

Output:
(defmacro fail (&rest message-args)
  "Simply generate a FAIL."
  `(process-failure ',message-args
                    ,@message-args))


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

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

Input:
(when-match common-lisp:nil
    common-lisp:nil)

Output:
(defmacro when-match (pattern arg &body body)
  "Equivalent to (match ARG (PATTERN BODY...))."
  `(match ,arg (,pattern ,.body)))


Instruction:
Generate a defmacro form that transforms code like this:
(cell-let nil)

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

Input: (cell-let nil)

Output:
(defmacro cell-let ((&rest bindings) &body body &environment env)
  "Define cells that are visible only to the forms in BODY.

BINDINGS is a list of cell bindings to establish, similar to
LET*. Each item in BINDINGS is a list of the form

.. code-block::

   (NAME VALUE-FORM)

where NAME is the symbol identifying the cell and VALUE-FORM is the
value form of the cell. The cell can then be referenced within the
forms in BODY by the symbol NAME.

The cells defined in BINDINGS lexcially shadow those in the
environment defined with DEFCELL or by an enclosing CELL-LET
form. Like LET* and unlike LET, each cell definition may reference the
cells defined earlier in the same CELL-LET.

The forms in BODY are evaluated in an implicit PROGN. The value
returned by the last form is returned by the CELL-LET form."

  (flet ((make-cell-binding (binding form)
           (destructuring-bind (name &optional initform)
               (ensure-list binding)

             (if (constantp initform env)
                 `(mutable-cell-let% (,name ,initform) ,form)
                 `(computed-cell-let% (,name ,initform) ,form)))))

    (->> `(progn ,@body)
         (reduce #'make-cell-binding bindings :from-end t :initial-value))))


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

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

Input:
(declaim nil
         nil)

Output: (defmacro DECLAIM ...)


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

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

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

Output:
(defmacro nand (&rest forms)
  "Equivalent to (not (and ...))."
  (if (null forms) nil
      (if (null (rest forms))
          `(not ,(first forms))
          `(if ,(first forms)
               (nand ,@(rest forms))
               t))))


Instruction:
Define a macro that eliminates this repetitive pattern:
(eval-when-load)

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

Input: (eval-when-load)

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


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

Issue: Macro call that should be transformed by COUNT-FAILURES

Input:
(count-failures
  'lol-gen::some-name)

Output: (defmacro COUNT-FAILURES ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(with-live-scope)

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

Input: (with-live-scope)

Output:
(defmacro with-live-scope (&body body)
  "Stop all live blocks defined in BODY on exiting the form.

All live blocks, defined using LIVE, are stopped when exiting the
dynamic extent defined by this form.

Multiple WITH-LIVE-SCOPE forms can be nested, in which case each form
stops the live blocks defined immediately within it."

  (with-gensyms (stoppers forms global-live)
    `(let ((,stoppers nil))
       (macrolet ((,global-live (&body ,forms)
                    (macroexpand `(live ,@,forms)))

                  (live (&body ,forms)
                    `(push (,',global-live ,@,forms) ,',stoppers)))
         (unwind-protect (progn ,@body)
           (foreach #'funcall ,stoppers))))))


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

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

Input: (defjsmacro)

Output: (defmacro DEFJSMACRO ...)


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

Problem: Macro call that should be transformed by DEFSYNTAX

Input:
(defsyntax nil
    :key
    nil)

Output:
(defmacro defsyntax (tags packages lambda-list &body body)
  "Define syntax for tags from specific packages"
  (let ((tags (if (listp tags) tags (list tags))))
    `(progn
       ,@(loop for i in tags append
	   (loop for k in packages collect
	     `(let ((tag ',i))
		(declare (ignorable tag))
		(defmacro ,(intern (format nil "~:@(~a~)" i) k) ,lambda-list
		  ,@body)
		(export ',(intern (format nil "~:@(~a~)" i) k) ,k)))))))


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

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

Input:
(slet nil
  (progn))

Output:
(defmacro slet (form &body body)
  "Binds the FORM to IT (via SYMBOL-MACROLET) in the scope of the BODY. IT can
be set with SETF."
  `(symbolic ignore-first ,form (progn ,@body)))


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

Write a macro that addresses: Macro call that should be transformed by DEFINE-PRINT-OBJECT/STD

Input: (define-print-object/std 'lol-gen::some-name)

Output:
(defmacro define-print-object/std (class)
  "Define a print-object method for objects of class CLASS.

  Print all slots with their values. Prints \"UNBOUND\", as a string, when slots are unbound.

  Usage:

  (defclass/std test () ((a b)))

  (print-object/std test)

  The macro expands to:

  (DEFMETHOD PRINT-OBJECT ((OBJ TEST) STREAM)
    (PRINT-UNREADABLE-OBJECT (OBJ STREAM :TYPE T :IDENTITY T)
        (FORMAT STREAM \"~{~a~^ ~}\" (COLLECT-OBJECT-SLOTS OBJ))))
"
  `(defmethod print-object ((obj ,class) stream)
     (print-unreadable-object (obj stream :type t :identity t)
       (format stream "~{~a~^ ~}"
               (collect-object-slots obj)))))


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

Problem: Macro call that should be transformed by DESTRUCTURING-CASE

Input: (destructuring-case 'lol-gen::some-name)

Output: (defmacro DESTRUCTURING-CASE ...)


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

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

Input:
(lambda-ematch1 common-lisp:nil
  common-lisp:nil)

Output:
(defmacro lambda-ematch1 (pattern &body body)
  "Equivalent to (lambda (arg) (ematch arg (PATTERN BODY...)))."
  `(lambda-ematch (,pattern ,@body)))


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

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

Input:
(with-constant-inject-hook nil
  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:
You are a Common Lisp macro expert. Given this code pattern:
(.> common-lisp:nil :key common-lisp:nil)

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

Input: (.> common-lisp:nil :key common-lisp:nil)

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:
You are a Common Lisp macro expert. Given this code pattern:
(defgeneric* nil
    (progn))

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

Input:
(defgeneric* nil
    (progn))

Output: (defmacro DEFGENERIC* ...)


Instruction:
Generate a defmacro form that transforms code like this:
(nsplice-seqf nil)

Pattern to recognize: Macro call that should be transformed by NSPLICE-SEQF

Input: (nsplice-seqf nil)

Output: (defmacro NSPLICE-SEQF ...)


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

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

Input:
(atypecase nil
  :key
  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:
(cond->
  nil
  :key
  nil)

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

Input:
(cond->
  nil
  :key
  nil)

Output: (defmacro COND-> ...)


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

Write a macro that addresses: Macro call that should be transformed by CALL-METHOD

Input: (call-method nil (progn))

Output:
(defmacro call-method (method &optional methods)
  `(cl:call-method ,method ,methods))


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

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

Input: (deletef nil :key nil)

Output: (defmacro DELETEF ...)


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

Problem: Macro call that should be transformed by LOOP

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

Output: (defmacro LOOP ...)


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

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

Input:
(dletf* nil
  :key
  nil)

Output: (defmacro DLETF* ...)


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

What needs to change: Macro call that should be transformed by WITH-CONSTANT-INJECT-HOOK

Input: (with-constant-inject-hook 'lol-gen::some-name)

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:
Define a macro that eliminates this repetitive pattern:
(auto-permute-typecase nil
  nil)

Issue: Macro call that should be transformed by AUTO-PERMUTE-TYPECASE

Input:
(auto-permute-typecase nil
  nil)

Output: (defmacro AUTO-PERMUTE-TYPECASE ...)


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

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

Input:
(with-gensyms nil
  (progn))

Output:
(defmacro with-gensyms (names &body forms)
  "Binds a set of variables to gensyms and evaluates the implicit progn FORMS.

Each element within NAMES is either a symbol SYMBOL or a pair (SYMBOL
STRING-DESIGNATOR). Bare symbols are equivalent to the pair (SYMBOL SYMBOL).

Each pair (SYMBOL STRING-DESIGNATOR) specifies that the variable named by SYMBOL
should be bound to a symbol constructed using GENSYM with the string designated
by STRING-DESIGNATOR being its first argument."
  `(let ,(mapcar (lambda (name)
                   (multiple-value-bind (symbol string)
                       (etypecase name
                         (symbol
                          (values name (symbol-name name)))
                         ((cons symbol (cons string-designator null))
                          (values (first name) (string (second name)))))
                     `(,symbol (gensym ,string))))
                 names)
     ,@forms))


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

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

Input: (w/uniqs nil)

Output: (defmacro W/UNIQS ...)


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

Problem: Macro call that should be transformed by EMATCH*

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

Output:
(defmacro ematch* (whats &body clauses)
  #.+match*-doc+
  (let ((temps (make-gensyms whats "OTHERWISE")))
    `(match2* ,whats
       ,@clauses
       (,temps
        (error 'match-error :pattern ',clauses :values (list ,@temps))))))


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

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

Input: (dlet nil)

Output: (defmacro DLET ...)


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

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

Input: (defhook nil :key nil)

Output:
(defmacro defhook (generic-function hook-name &rest args)
  "define a hook to be to be called by the effective method.

This macro has roughly the same signature as defmethod `(DEFHOOK GENERIC-FUNCTION HOOK-NAME {QUALIFIER} SPECIALIZED-LAMBDA-LIST &BODY BODY)`
creates a function `hook-name` with the `body` then creates a method to dispatch all hooks matching
the type-list for the given generic-function.

See define-hook-generic
See finalize-dispatch-method"
  (%destructure-defhook-args args
    (destructure-specialized-lambda-list descriptive-lambda-list vanilla-lambda-list type-list specialized-lambda-list
      (with-effective-qualifier generic-function qualifier
        (intern-hook generic-function hook-name type-list qualifier)
        `(progn
           (%defhook-fun ,hook-name ,vanilla-lambda-list
                         ,@body)
           (%define-method-dispatch ,generic-function ,qualifier ,specialized-lambda-list))))))


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

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

Input:
(with-ps-gensyms nil
  nil)

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


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

Issue: Macro call that should be transformed by DYNAMIC-WIND

Input:
(dynamic-wind
  'lol-gen::some-name)

Output: (defmacro DYNAMIC-WIND ...)


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

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

Input:
(handler-bind nil
  (progn))

Output: (defmacro HANDLER-BIND ...)


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

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

Input:
(drelet nil
  :key
  nil)

Output: (defmacro DRELET ...)


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

Issue: Macro call that should be transformed by ASSERT!

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

Output: (defmacro ASSERT! ...)


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

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

Input:
(->> nil
  :key
  nil)

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


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

Problem: Macro call that should be transformed by THE-KIDS

Input: (the-kids 'lol-gen::some-name)

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


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

What needs to change: Macro call that should be transformed by EVAL-ALWAYS

Input:
(eval-always
  'lol-gen::some-name)

Output:
(defmacro eval-always (&body body)
  "Shorthand for
        (eval-when (:compile-toplevel :load-toplevel :execute) ...)"
  `(eval-when (:compile-toplevel :load-toplevel :execute)
     ,@body))


Instruction:
Define a macro that eliminates this repetitive pattern:
(do-generators nil
  (progn))

Issue: Macro call that should be transformed by DO-GENERATORS

Input:
(do-generators nil
  (progn))

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:
Generate a defmacro form that transforms code like this:
(mapping nil)

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

Input: (mapping nil)

Output: (defmacro MAPPING ...)


Instruction:
Define a macro that eliminates this repetitive pattern:
(static-let* nil
  :key
  nil)

Issue: Macro call that should be transformed by STATIC-LET*

Input:
(static-let* nil
  :key
  nil)

Output:
(defmacro static-let* ((&rest bindings) &body body &environment env)
  "Like `let*', except the variables are only initialized once and
retain their values between different invocations of `body'.

Every static binding is similar to a `let' binding, except it can have
additional keyword arguments:

- `type' Denotes the type of the variable.
- `once' If true, then binding initialization and mutation will be
         thread-safe.
- `flush' If true, this binding will be flushable. Defaults to true.
- `in' Denotes the static binding group in which the binding will be
       placed for flushing. Defaults to the value of `*package'.
- `read-only' If true, then the binding cannot be mutated with `setf'.

Static bindings can be flushed via `flush-static-binding-group' and
`flush-all-static-binding-groups'; the latter is automatically pushed
into `uiop:*dump-image-hooks*' by Serapeum.

An unflushable static binding will carry its value over into dumped
Lisp binaries."
  (parse-static-let* bindings body env))


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

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

Input: (step nil)

Output: (defmacro STEP ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(ignore-some-conditions nil
  :key
  nil)

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

Input:
(ignore-some-conditions nil
  :key
  nil)

Output:
(defmacro ignore-some-conditions ((&rest conditions) &body body)
  "Similar to CL:IGNORE-ERRORS but the (unevaluated) CONDITIONS
list determines which specific conditions are to be ignored."
  `(handler-case
       (progn ,@body)
     ,@(loop for condition in conditions collect
             `(,condition (c) (values nil c)))))


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

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

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

Output: (defmacro MINF ...)


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

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

Input:
(finishes
  nil)

Output:
(defmacro finishes (&body body)
  "Generates a pass if BODY executes to normal completion. In
other words if body does signal, return-from or throw this test
fails."
  `(unwind-protect-case () (progn ,@body)
     (:normal (add-result 'test-passed :test-expr ',body))
     (:abort (process-failure ',body "Test didn't finish"))))


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

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

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

Output: (defmacro EVAL-ALWAYS ...)


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

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

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

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


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

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

Input: (handler-bind nil)

Output: (defmacro HANDLER-BIND ...)


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

Issue: Macro call that should be transformed by MATCH

Input: (match nil)

Output: (defmacro MATCH ...)


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

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

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

Output: (defmacro WHILE ...)


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

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

Input:
(jwhen nil
  (progn))

Output:
(defmacro jwhen (test &body body)
  "JSON-aware version of `cl:when'.
If TEST is `jtruep' evaluate BODY."
  `(jif ,test
       (progn ,@body)))


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

Issue: Macro call that should be transformed by SECASE

Input:
(secase nil
  (progn))

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


Instruction:
You are a Common Lisp macro expert. Given this code pattern:
(define-global-var* nil nil)

Write a macro that addresses: Macro call that should be transformed by DEFINE-GLOBAL-VAR*

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

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


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

Issue: Macro call that should be transformed by DEFLOOP

Input:
(defloop nil
    (progn))

Output:
(defmacro defloop (name args &body body)
  "Define a function, ensuring proper tail recursion.
This is entirely equivalent to `defun' over `nlet'."
  (multiple-value-bind (body decls docstring)
      (parse-body body :documentation t)
    (let ((vars (lambda-list-vars args)))
      `(defun ,name ,args
         ,@(unsplice docstring)
         ,@decls
         (nlet ,name ,(mapcar #'list vars vars)
           (flet ((,name ,args (,name ,@vars)))
             (declare (inline ,name))
             ,@body))))))


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

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

Input: (as common-lisp:nil)

Output:
(defmacro as (type cl:&optional (expr cl:nil expr-supplied-p))
  "A syntactic convenience for type casting.

    (as <type> <expr>)

is equivalent to

    (the <type> (into <expr>))

and

    (as <type>)

is equivalent to

    (fn (expr) (the <type> (into expr))).

Note that this may copy the object or allocate memory."

  (cl:let ((into (cl:ignore-errors (cl:find-symbol "INTO" "COALTON/CLASSES"))))
    (cl:assert into () "`as` macro does not have access to `into` yet.")
    (cl:if expr-supplied-p
           `(the ,type (,into ,expr))
           (alexandria:with-gensyms (lexpr)
             `(fn (,lexpr)
                (the ,type (,into ,lexpr)))))))


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

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

Input:
(defgeneric* nil
    nil)

Output: (defmacro DEFGENERIC* ...)


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

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

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

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:
Create a Common Lisp macro for the following transformation. Before code:
(@ nil (progn))

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

Input: (@ nil (progn))

Output: (defmacro @ ...)


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

Write a macro that addresses: Macro call that should be transformed by WITH-ACTIVE-LAYERS*

Input:
(with-active-layers* nil
  nil)

Output: (defmacro WITH-ACTIVE-LAYERS* ...)


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(eval-when-execute
  common-lisp:nil
  common-lisp:nil)

What needs to change: Macro call that should be transformed by EVAL-WHEN-EXECUTE

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

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


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

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

Input: (or)

Output: (defmacro OR ...)


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

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

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

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


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

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

Input: (coercef nil (progn))

Output: (defmacro COERCEF ...)


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

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

Input: (or nil nil)

Output: (defmacro OR ...)


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

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

Input: (rte-case 'lol-gen::some-name)

Output: (defmacro RTE-CASE ...)


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

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

Input: (right nil (progn))

Output:
(defmacro right (parser &rest parsers)
  "Combination of parsers yielding the result of the rightmost one."
  `(*> ,parser ,@parsers))


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

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

Input: (defvar nil)

Output: (defmacro DEFVAR ...)


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

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

Input:
(do-sequences nil
  (progn))

Output:
(defmacro do-sequences (name/seqs &body forms &environment env)
  "Iterate over the elements of one or more sequences.

   Iteration is performed using the iterator interface, and over
   multiple sequences simultaneously.

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

    1. (NAME (&REST SEQS) &BODY BODY)

    2. ((&REST SEQS) &BODY BODY)

   NAME is a symbol serving as the name of the BLOCK from which the
   forms in BODY can return, using (RETURN-FROM NAME ...). If not
   given defaults to NIL.

   Each element of SEQS is a list of the form (VAR SEQUENCE . ARGS),
   where VAR is the variable to which the element of the sequence,
   SEQUENCE, is bound, at each iteration, and ARGS are arguments
   passed to the ITERATOR function, after the sequence.

   BODY is a list of forms evaluated at each iteration. RETURN-FROM to
   the block named NAME may be used to terminate the iteration early
   and return a value from the DO-SEQUENCES form. NIL is returned if
   there is no explicit RETURN."

  (let-if ((name name/seqs)
           (seqs (first forms) name/seqs)
           (forms (rest forms) forms))
      (symbolp name/seqs)

    (let ((safety (cadr (assoc 'safety (declaration-information 'optimize env)))))
      `(,(if (> safety 2)
             'do-sequences-safe%
             'do-sequences-fast%)

         ,name
         ,seqs
         ,@forms))))


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

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

Input: (aetypecase nil)

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


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

Issue: Macro call that should be transformed by SOR

Input: (sor nil :key nil)

Output:
(defmacro sor (first &rest rest)
  "Like OR, except binds the first argument to IT (via SYMBOL-MACROLET) for
the scope of the rest of the arguments. IT can be set with SETF."
  `(symbolic or ,first ,@rest))


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

Write a macro that addresses: Macro call that should be transformed by CASE-USING

Input:
(case-using nil
    :key
  nil)

Output:
(defmacro case-using (pred keyform &body clauses)
  "ISLISP's case-using.

     (case-using #'eql x ...)
     ≡ (case x ...).

Note that, no matter the predicate, the keys are not evaluated. (But
see `selector'.)

The PRED form is evaluated.

When PRED is invoked, KEYFORM is its first argument. You can use
`flip' if you want the arguments passed the other way around. For
example, to dispatch on potential elements of a list:

    (case-using list (flip #'member)
      (:item1 ...))

This version supports both single-item clauses (x ...) and
multiple-item clauses ((x y) ...), as well as (t ...) or (otherwise
...) for the default clause."
  (case (extract-function-name pred)
    (eql
     `(case ,keyform
        ,@clauses))
    ;; TODO Check that this isn't rebound in the environment. (Not a
    ;; concern on SBCL as the package is locked there.)
    (string=
     `(string-case ,keyform
        ,@clauses))
    (t `(case-using-aux ,pred ,keyform
          ,@clauses))))


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

Write a macro that addresses: Macro call that should be transformed by IGNORE-ERRORS

Input: (ignore-errors nil)

Output: (defmacro IGNORE-ERRORS ...)


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

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

Input: (cll-inner nil)

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


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

Write a macro that addresses: Macro call that should be transformed by PPRINT-LOGICAL-BLOCK

Input: (pprint-logical-block 'lol-gen::some-name)

Output: (defmacro PPRINT-LOGICAL-BLOCK ...)


Instruction:
Write a Common Lisp macro to handle this code pattern:
(inext-or-error nil (progn))

Problem: Macro call that should be transformed by INEXT-OR-ERROR

Input: (inext-or-error nil (progn))

Output: (defmacro INEXT-OR-ERROR ...)


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

Write a macro that addresses: Macro call that should be transformed by C-FORMULA

Input: (c-formula nil)

Output:
(defmacro c-formula ((&rest keys &key lazy &allow-other-keys) &body forms)
  (assert (member lazy '(nil t :once-asked :until-asked :always)))
  `(make-c-dependent
    :code ',forms
    :value-state :unevaluated
    :rule (c-lambda ,@forms)
    ,@keys))


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

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

Input: (defmethod* nil nil)

Output: (defmacro DEFMETHOD* ...)


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

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

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

Output:
(defmacro define-test+run (name &body args-and-body)
  `(progn
     (define-test ,name ,@args-and-body)
     (eval-when (:execute)
       (let* ((*silence-plain-compilation-errors-p* nil) ; must be let*! the order matters!
              (report (test ',name :report 'plain)))
         (if (member (status report) '(:passed :skipped))
             report
             (values report
                     (loop for result across (results report)
                           when (and (not (typep result 'test-result))
                                     (eql :failed (status result)))
                           collect (expression result))))))))


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

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

Input:
(lambda-ematch*
  common-lisp:nil
  :key
  common-lisp:nil)

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


Instruction:
Create a Common Lisp macro for the following transformation. Before code:
(pprint-coalton-codegen-ast
  common-lisp:nil
  common-lisp:nil)

What needs to change: Macro call that should be transformed by PPRINT-COALTON-CODEGEN-AST

Input:
(pprint-coalton-codegen-ast
  common-lisp:nil
  common-lisp:nil)

Output: (defmacro PPRINT-COALTON-CODEGEN-AST ...)


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

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

Input:
(with-html-string
  nil
  :key
  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:
Generate a defmacro form that transforms code like this:
(xml nil nil)

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

Input: (xml nil nil)

Output:
(defmacro xml (&rest tags)
  `(with-doctype :xml
     (loop for tag in ',tags
           append (tag->string tag))))


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

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

Input:
(with-boolean nil
  :key
  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)))))))))