j14i/cl-macros huggingface dataset:
Define a macro that eliminates this repetitive pattern:
(with-additional-indent (reporter stream "× ") (when (slot-value report 'description) (format/indent reporter stream "~A~%" (slot-value report 'description))) (format/indent reporter stream "Raised an error ~A (expected: ~S)" (slot-value report 'got) (slot-value report 'expected)))

Issue: Macro call that should be transformed by with-additional-indent

Macro definition:
(defmacro with-additional-indent ((reporter stream control-string &rest format-arguments) &body body)
  (declare (ignorable reporter stream control-string))
  (let* ((need-new-line (ppcre:scan "^~&" control-string))
         (string (apply #'format nil control-string format-arguments))
         (increment (length string)))
    `(with-slots (indent-space) reporter
       (let* ((first-line-indent (indent indent-space))
              (*additional-indent* ,(if need-new-line
                                        increment
                                        `(+ *additional-indent*
                                            ,increment))))
         (declare (ignorable first-line-indent))
         ,(if need-new-line
              `(progn (fresh-line stream)
                      (write-string first-line-indent ,stream)
                      ;; because we just started a new line, we
                      ;; should use format/indent to write string
                      ;; taking into account a main indentation level
                      (format/indent ,reporter ,stream ,string))
              ;; otherwise, just output our prefix
              `(write-string ,string ,stream))
       
       
         ,@body))))

Macroexpansion:
(with-slots (indent-space) reporter (let* ((first-line-indent (indent indent-space)) (*additional-indent* (+ *additional-indent* 2))) (declare (ignorable first-line-indent)) (write-string "× " stream) (when (slot-value report (quote description)) (format/indent reporter stream "~A~%" (slot-value report (quote description)))) (format/indent reporter stream "Raised an error ~A (expected: ~S)" (slot-value report (quote got)) (slot-value report (quote expected)))))
You are a Common Lisp macro expert. Given this code pattern:
(node 'some-name)

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

Macro definition:
(defmacro NODE ...)

Macroexpansion:
(make+finish-node+relations quote some-name 'nil 'nil)
Generate a defmacro form that transforms code like this:
(-<> nil nil)

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

Macro definition:
(defmacro -<> ...)

Macroexpansion:
(-> nil nil)
Write a Common Lisp macro to handle this code pattern:
(slet it it)

Problem: Macro call that should be transformed by slet

Macro definition:
(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)))

Macroexpansion:
(symbolic ignore-first it (progn it))
Write a Common Lisp macro to handle this code pattern:
(def-neo4j-fun traverse (node-id (return-type :node) (max-depth 1) (order :depth-first) uniqueness relationships prune-evaluator return-filter) :post (:uri-spec (format nil "node/~A/traverse/~A" node-id (string-downcase (symbol-name return-type)))) (:encode (list (cons "order" (case order (:depth-first "depth_first") (:breadth-first "breadth_first"))) (cons "uniqueness" uniqueness) (cons "relationships" relationships) (cons "prune_evaluator" prune-evaluator) (cons "return_filter" return-filter) (cons "max_depth" max-depth)) :string) (:status-handlers (200 (decode-neo4j-json-output body)) (404 (error 'node-not-found-error :uri uri))))

Problem: Macro call that should be transformed by def-neo4j-fun

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

Macroexpansion:
(progn (defun traverse (&key node-id (return-type :node) (max-depth 1) (order :depth-first) uniqueness relationships prune-evaluator return-filter) (let ((uri (format nil "node/~A/traverse/~A" node-id (string-downcase (symbol-name return-type)))) (json (encode-neo4j-json-payload (list (cons "order" (case order (:depth-first "depth_first") (:breadth-first "breadth_first"))) (cons "uniqueness" uniqueness) (cons "relationships" relationships) (cons "prune_evaluator" prune-evaluator) (cons "return_filter" return-filter) (cons "max_depth" max-depth)) :string))) (make-neo4j-request :post uri json (list (list 200 (lambda (body uri json) (decode-neo4j-json-output body))) (list 404 (lambda (body uri json) (error (quote node-not-found-error) :uri uri))))))))
Create a Common Lisp macro for the following transformation. Before code:
(matrix-etypecase nil)

What needs to change: Macro call that should be transformed by MATRIX-ETYPECASE

Macro definition:
(defmacro MATRIX-ETYPECASE ...)

Macroexpansion:
nil
Create a Common Lisp macro for the following transformation. Before code:
(defsynonym next-iteration :next-iteration)

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

Macro definition:
(defmacro defsynonym (symbol synonym)
  "Set SYNONYM for a SYMBOL. "
  `(eval-always
     (setf (get ',symbol 'synonym) ',synonym)))

Macroexpansion:
(eval-always (setf (get (quote next-iteration) (quote synonym)) (quote :next-iteration)))
Generate a defmacro form that transforms code like this:
(defsynonym first-iteration-p :first-iteration-p)

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

Macro definition:
(defmacro defsynonym (symbol synonym)
  "Set SYNONYM for a SYMBOL. "
  `(eval-always
     (setf (get ',symbol 'synonym) ',synonym)))

Macroexpansion:
(eval-always (setf (get (quote first-iteration-p) (quote synonym)) (quote :first-iteration-p)))
Create a Common Lisp macro for the following transformation. Before code:
(with-env [plist :c])

What needs to change: Macro call that should be transformed by with-env

Macro definition:
(defmacro with-env (&body body)
  (let ((body-value (gensym)))
    `(let (,body-value)
       (defclass foo () ((a :initform 3)))
       (defmethod get-val ((object foo) &rest slot/s) (slot-value object (car slot/s)))
       (defmethod (setf get-val) (new-value (object foo) &rest slot/s)
         (setf (slot-value object (car slot/s)) new-value))
       (defstruct bar a)
       (setq ,body-value
             (let ((str (alexandria:copy-array "abcde"))
                   (vec (alexandria:copy-array #(a b c d e)))
                   (arr (alexandria:copy-array #2A((1 2 3)
                                                   (4 5 6))))
                   (list      (copy-list '(a b c d e)))
                   (ht        (eval (read-from-string "{'a 'b 'c 'd}")))
                   (ht-eq     (eval (read-from-string "{eq \"a\" 1
                                                    \"b\" 2}")))
                   (ht-equalp (eval (read-from-string "{equalp '(1 2 3) \"a\"
                                                               '(4 5 6) \"b\"}")))
                   (assoc-list (copy-tree '((a . 1) (b . 2))))
                   (plist      (copy-list '(:a 4 :c 5)))
                   (clos-object (make-instance 'foo))
                   (struct      (make-bar :a 3)))
               (declare (ignorable str vec arr list ht ht-eq ht-equalp
                                   assoc-list plist clos-object struct))
               ,@body))
       (setf (find-class 'foo nil) nil)
       (setf (find-class 'bar nil) nil)
       ,body-value))

Macroexpansion:
(let (#:g129) (defclass foo nil ((a :initform 3))) (defmethod get-val ((object foo) &rest slot/s) (slot-value object (car slot/s))) (defmethod (setf get-val) (new-value (object foo) &rest slot/s) (setf (slot-value object (car slot/s)) new-value)) (defstruct bar a) (setq #:g129 (let ((str (alexandria:copy-array "abcde")) (vec (alexandria:copy-array #(a b c d e))) (arr (alexandria:copy-array #2A((1 2 3) (4 5 6)))) (list (copy-list (quote (a b c d e)))) (ht (eval (read-from-string "{'a 'b 'c 'd}"))) (ht-eq (eval (read-from-string "{eq \"a\" 1
                                                    \"b\" 2}"))) (ht-equalp (eval (read-from-string "{equalp '(1 2 3) \"a\"
                                                               '(4 5 6) \"b\"}"))) (assoc-list (copy-tree (quote ((a . 1) (b . 2))))) (plist (copy-list (quote (:a 4 :c 5)))) (clos-object (make-instance (quote foo))) (struct (make-bar :a 3))) (declare (ignorable str vec arr list ht ht-eq ht-equalp assoc-list plist clos-object struct)) [plist :c])) (setf (find-class (quote foo) nil) nil) (setf (find-class (quote bar) nil) nil) #:g129)
You are a Common Lisp macro expert. Given this code pattern:
(keep-bops nil nil)

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

Macro definition:
(defmacro KEEP-BOPS ...)

Macroexpansion:
(eval-when (:load-toplevel :compile-toplevel :execute)
  (progn
   (init-binfix)
   (unless nil
     (setq *binfix*
             (delete nil
                     (mapcar
                      (lambda (bs)
                        (setq bs
                                (delete-if
                                 (lambda (b)
                                   (unless (member (car b) '(nil nil))
                                     (remprop (car b) 'properties)
                                     t))
                                 bs)))
                      *binfix*)))
     (assign-properties))))
Generate a defmacro form that transforms code like this:
(f_%
  nil
  (progn))

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

Macro definition:
(defmacro F_% ...)

Macroexpansion:
(lambda (&rest #:|ignore128|) (declare (ignore #:|ignore128|)) nil (progn))
Define a macro that eliminates this repetitive pattern:
(defsyntax nil
  :key
  nil)

Issue: Macro call that should be transformed by DEFSYNTAX

Macro definition:
(defmacro defsyntax (name &body options)
  `(progn
     (setf (get ',name :options) ',options)
     (defvar ,name (defreadtable ,name ,@options))))

Macroexpansion:
(progn
 (setf (get 'nil :options) '(:key nil))
 (defvar nil
   (defreadtable nil
     :key
     nil)))
You are a Common Lisp macro expert. Given this code pattern:
(as-> nil (progn))

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

Macro definition:
(defmacro AS-> ...)

Macroexpansion:
(let* (((progn) nil))
  (progn))
Generate a defmacro form that transforms code like this:
(when (cdr clauses) `(cond ,@(cdr clauses)))

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

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

Macroexpansion:
(if (cdr clauses) (sb-int:quasiquote (cond #S(sb-impl::comma :expr (cdr clauses) :kind 2))))
Generate a defmacro form that transforms code like this:
(gathering nil
  (progn))

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

Macro definition:
(defmacro GATHERING ...)

Macroexpansion:
(common-lisp:let ()
  (progn)
  (values))
Generate a defmacro form that transforms code like this:
(defun-compile-time is-magic-declaration? (form) (and (consp form) (eq (first form) 'declare) (consp (rest form)) (consp (second form)) (eq (first (second form)) 'magic)))

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

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

Macroexpansion:
(eval-when (:compile-toplevel :load-toplevel :execute) (common-lisp:defun is-magic-declaration? (form) (and (consp form) (eq (first form) (quote declare)) (consp (rest form)) (consp (second form)) (eq (first (second form)) (quote magic)))) (eval-when (:compile-toplevel) (compile (quote is-magic-declaration?))))
Write a Common Lisp macro to handle this code pattern:
(lret* () 1)

Problem: Macro call that should be transformed by lret

Macro definition:
(defmacro lret ((&rest bindings) &body body)
  "Return the initial value of the last binding in BINDINGS. The idea
is to create something, initialize it, and then return it.

    (lret ((x 1)
           (y (make-array 1)))
      (setf (aref y 0) x))
    => #(1)

Note that the value returned is the value initially bound. Subsequent
assignments are ignored.

    (lret ((x 1))
      (setf x 2))
    => 1

Furthermore, on Lisps that support it, the variable may be made
read-only, making assignment a compiler-time error.

`lret' may seem trivial, but it fufills the highest purpose a macro
can: it eliminates a whole class of bugs (initializing an object, but
forgetting to return it).

Cf. `aprog1' in Anaphora."
  `(lret-aux let ,bindings
     ,@body))

Macroexpansion:
(lret-aux let* nil 1)
Generate a defmacro form that transforms code like this:
(define-declaration nil
    (progn))

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

Macro definition:
(defmacro DEFINE-DECLARATION ...)

Macroexpansion:
(eval-when (:compile-toplevel :load-toplevel :execute)
  (proclaim '(declaration nil))
  (flet ((sb-cltl2::func (progn)
           ))
    (setf (sb-int:info :declaration :known 'nil)
            (lambda
                (sb-kernel:lexenv sb-cltl2::spec sb-cltl2::pd-vars
                 sb-cltl2::pd-fvars)
              (multiple-value-bind (sb-cltl2::kind sb-cltl2::data)
                  (sb-cltl2::func sb-cltl2::spec sb-kernel:lexenv)
                (sb-cltl2::update-lexenv-user-data sb-kernel:lexenv
                                                   sb-cltl2::kind
                                                   sb-cltl2::data
                                                   sb-cltl2::pd-vars
                                                   sb-cltl2::pd-fvars))))))
Write a Common Lisp macro to handle this code pattern:
(ps-html nil (progn))

Problem: Macro call that should be transformed by PS-HTML

Macro definition:
(defmacro PS-HTML ...)

Macroexpansion:
(stringify nil (progn))
Generate a defmacro form that transforms code like this:
(defclass/a dbd-postgres-query (dbi-query) ((name :initarg :name) (freedp :initform nil :accessor query-freed-p)) (:default-initargs :fields nil))

Pattern to recognize: Macro call that should be transformed by defclass/a

Macro definition:
(defmacro defclass/a (name superclasses slots &rest class-options)
  `(progn
     (defclass ,name ,superclasses ,slots ,@class-options)
     (deftype ,(intern (format nil "<~A>" (symbol-name name))) () ',name)
     (setf (find-class ',(intern (format nil "<~A>" (symbol-name name))))
           (find-class ',name))))

Macroexpansion:
(progn (defclass dbd-postgres-query (dbi-query) ((name :initarg :name) (freedp :initform nil :accessor query-freed-p)) (:default-initargs :fields nil)) (deftype <dbd-postgres-query> nil (quote dbd-postgres-query)) (setf (find-class (quote <dbd-postgres-query>)) (find-class (quote dbd-postgres-query))))
You are a Common Lisp macro expert. Given this code pattern:
(c?-with-stored (v :bar store 'nothing) (bwhen (val (value v)) (1- val)))

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

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

Macroexpansion:
(c? (bwhen-c-stored (v :bar store (quote nothing)) (bwhen (val (value v)) (1- val))))
Write a Common Lisp macro to handle this code pattern:
(make-window-or-instance nil)

Problem: Macro call that should be transformed by MAKE-WINDOW-OR-INSTANCE

Macro definition:
(defmacro MAKE-WINDOW-OR-INSTANCE ...)

Macroexpansion:
(make-$instance nil)
You are a Common Lisp macro expert. Given this code pattern:
(with-iter-value (value it) value)

Write a macro that addresses: Macro call that should be transformed by with-iter-value

Macro definition:
(defmacro with-iter-value ((pattern iter) &body body)
  "Bind the current element of a sequence, pointed to by a static iterator, to a variable.

   This macro may only be used within the body of a WITH-ITERATORS
   macro.

   The current value of the sequence, with iterator ITER, is bound to
   the variable(s) specified by PATTERN, with the bindings visible to
   FORMS.

   If the iterator is already at the end of the sequence a non-local
   jump, to the end of the enclosing WITH-ITERATORS form, is
   performed.

   After binding, the iterator is advanced to the next element of the
   sequence.

   PATTERN:

     A binding pattern specifying the variable(s) to which the current
     element of the sequence is bound.

     This may either be a symbol, naming a variable, or a list which
     is interpreted as a pattern to `destructuring-bind`.

   ITER:

     Symbol identifying the iterator, as established by the
     WITH-ITERATORS form.

     This must name an iterator introduced in a parent WITH-ITERATORS
     form.

   BODY:

     The body of the WITH-ITER-VALUE form:

       (DECLARATION* FORM*)

     The body consists of a list of forms evaluated in an implicit
     PROGN, with the value of the last form returned from the
     WITH-ITER-VALUE form. The binding(s) introduced by PATTERN are
     visible to forms.

     The forms may be preceded by declaration expressions, which may
     apply to the variables introduced in PATTERN.

     NOTE: If there are no more elements in the sequence, the forms
     are not evaluated and a non-local jump to the end of the
     enclosing WITH-ITERATORS form is performed."

  `(with-iter-values ((,pattern ,iter)) ,@body))

Macroexpansion:
(with-iter-values ((value it)) value)
Create a Common Lisp macro for the following transformation. Before code:
(%escape-string-form form)

What needs to change: Macro call that should be transformed by %escape-string-form

Macro definition:
(defmacro %escape-string-form (val)
  (let ((val2 (gensym)))
    `(let ((,val2 ,val))
       (if (should-escape-p ,val2)
           `(escape-string ,,val2)
           ,val2))))

Macroexpansion:
(let ((#:g122 form)) (if (should-escape-p #:g122) (sb-int:quasiquote (escape-string #S(sb-impl::comma :expr #:g122 :kind 0))) #:g122))
Write a Common Lisp macro to handle this code pattern:
(undefreply nil :key nil)

Problem: Macro call that should be transformed by UNDEFREPLY

Macro definition:
(defmacro UNDEFREPLY ...)

Macroexpansion:
(undefine-reply 'nil :qualifiers '(:key) :participants `nil)
Write a Common Lisp macro to handle this code pattern:
(action (:after node-lisp node bound-variables) (let ((new-vars (loop :for (lisp-var . coalton-var) :in (node-lisp-vars node) :for target := (and (not (member coalton-var bound-variables :test #'eq)) (alias-substitution-target coalton-var aliases)) :collect (cons lisp-var (if target (node-variable-value target) coalton-var))))) (unless (equal new-vars (node-lisp-vars node)) (make-node-lisp :type (node-type node) :vars new-vars :form (node-lisp-form node)))))

Problem: Macro call that should be transformed by action

Macro definition:
(defmacro action ((when type &rest args) &body body)
  "Construct an action block, turning `body` into a lambda function
accepting `args` if `args` are provided. If there are no `args`, then
`body` is assumed to be a function object and is used directly with
`when` and `type` to create an `action` instance. Otherwise, the first
argument in `args` is declared to be a node of type `type`, and the
`args` and `body` are used to generate a lambda function."
  (check-type when keyword)
  (check-type type symbol)
  (assert (subtypep type 'node))
  (assert (or (not (endp args)) (= 1 (length body))))
  (if (endp args)
      `(make-action ',when ',type ,@body)
      `(make-action ',when ',type
                    (lambda (,@args)
                      (declare (type ,type ,(first args)))
                      ,@body))))

Macroexpansion:
(make-action (quote :after) (quote node-lisp) (lambda (node bound-variables) (declare (type node-lisp node)) (let ((new-vars (loop :for (lisp-var . coalton-var) :in (node-lisp-vars node) :for target := (and (not (member coalton-var bound-variables :test (function eq))) (alias-substitution-target coalton-var aliases)) :collect (cons lisp-var (if target (node-variable-value target) coalton-var))))) (unless (equal new-vars (node-lisp-vars node)) (make-node-lisp :type (node-type node) :vars new-vars :form (node-lisp-form node))))))
Write a Common Lisp macro to handle this code pattern:
(defclass/std test () ((a b)))

Problem: Macro call that should be transformed by defclass/std

Macro definition:
(defmacro defclass/std (name direct-superclasses direct-slots &rest options
                        &environment env)
  "Shortcut macro to the DEFCLASS macro.

  (defclass/std example ()
    ((slot1 slot2 slot3)))

  expands to:

  (DEFCLASS EXAMPLE ()
    ((SLOT1 :ACCESSOR SLOT1 :INITARG :SLOT1 :INITFORM NIL)
    (SLOT2 :ACCESSOR SLOT2 :INITARG :SLOT2 :INITFORM NIL)
    (SLOT3 :ACCESSOR SLOT3 :INITARG :SLOT3 :INITFORM NIL)))

  Each slot definition accepts options:

    :std 1 => changes the :initform to 1. It can be :unbound.
    :with or :with-prefix => creates accessors with the class name as prefix.

  See the README for more.

  See also `class/std' and `print-object/std'.
  "
  `(defclass ,name ,direct-superclasses
     ,(process-slots env direct-slots name)
     ,@options))

Macroexpansion:
(defclass test nil ((a :accessor a :initarg :a :initform nil) (b :accessor b :initarg :b :initform nil)))
You are a Common Lisp macro expert. Given this code pattern:
(ƒ→ nil (progn))

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

Macro definition:
(defmacro Ƒ→ ...)

Macroexpansion:
(defn nil (progn) (&optional α)
      (let ((α (or α t)))
        (cond)))
Define a macro that eliminates this repetitive pattern:
(make-window-or-instance nil (progn))

Issue: Macro call that should be transformed by MAKE-WINDOW-OR-INSTANCE

Macro definition:
(defmacro MAKE-WINDOW-OR-INSTANCE ...)

Macroexpansion:
(make-$instance nil (progn))
Generate a defmacro form that transforms code like this:
(assoc-cdr "oauth_verifier" parameters #'equal)

Pattern to recognize: Macro call that should be transformed by assoc-cdr

Macro definition:
(defmacro assoc-cdr (key alist &optional (test '#'eql))
  `(cdr (assoc ,key ,alist :test ,test)))

Macroexpansion:
(cdr (assoc "oauth_verifier" parameters :test (function equal)))
Write a Common Lisp macro to handle this code pattern:
(some-<> nil)

Problem: Macro call that should be transformed by SOME-<>

Macro definition:
(defmacro SOME-<> ...)

Macroexpansion:
(let* ((#:g120 nil))
  #:g120)
Create a Common Lisp macro for the following transformation. Before code:
(some-> nil :key nil)

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

Macro definition:
(defmacro SOME-> ...)

Macroexpansion:
(let* ((#:|some128| nil)
       (#:|some128| (when #:|some128| (:key #:|some128|)))
       (#:|some128| (when #:|some128| (nil #:|some128|))))
  #:|some128|)