j14i/cl-macros huggingface dataset:
Write a Common Lisp macro to handle this code pattern:
(define-op (:is-distinct-from infix-op))

Problem: Macro call that should be transformed by define-op

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

Macroexpansion:
(defstruct (is-distinct-from-op (:include infix-op (name "IS DISTINCT FROM")) (:constructor make-is-distinct-from-op (left right))))
Generate a defmacro form that transforms code like this:
(defrule nil
  (progn))

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

Macro definition:
(defmacro DEFRULE ...)

Macroexpansion:
(setf (gethash #A((3) base-char . "NIL") cl-rules.core::*rules*)
        '#S(cl-rules.core::rule
            :name #A((3) base-char . "NIL")
            :conditions (#S(cl-rules.core::condn
                            :name #A((5) base-char . "PROGN")
                            :args nil))
            :actions nil))
You are a Common Lisp macro expert. Given this code pattern:
(defun* nil
    nil)

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

Macro definition:
(defmacro DEFUN* ...)

Macroexpansion:
(defun nil () (with-yield))
Define a macro that eliminates this repetitive pattern:
(define-modf-rewrite caadr (expr) `(car (cadr ,(second expr))))

Issue: Macro call that should be transformed by define-modf-rewrite

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

Macroexpansion:
(eval-when (:compile-toplevel :load-toplevel :execute) (setf (gethash (quote caadr) *modf-rewrites*) (lambda (expr) (sb-int:quasiquote (car (cadr #S(sb-impl::comma :expr (second expr) :kind 0)))))))
You are a Common Lisp macro expert. Given this code pattern:
(lambda-coro
  'some-name)

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

Macro definition:
(defmacro LAMBDA-CORO ...)

Macroexpansion:
(progn
 (defcoroutine #:name133
     (#:arg134)
   (macrolet ((yield (form)
                (let ((g!-it (gensym "IT")))
                  `(progn
                    (let ((,g!-it ,form))
                      (cl-coroutine:yield ,g!-it))
                    ,'#:arg134)))
              (last-yield-value ()
                '#:arg134))
     'some-name
     (coexit!)))
 (make-coroutine '#:name133))
Define a macro that eliminates this repetitive pattern:
(unless nil)

Issue: Macro call that should be transformed by UNLESS

Macro definition:
(defmacro UNLESS ...)

Macroexpansion:
(if nil
    nil
    nil)
You are a Common Lisp macro expert. Given this code pattern:
(with-prepared-query query (*connection* sql :use-prepare-cached *use-prepare-cached*) (let* ((query (with-trace-sql (execute-with-retry query binds))) (format (or format :plist)) (*plist-row-lispify* (if lispify-specified lispify (case format (:plist t) (otherwise nil))))) (retrieve-from-query query format)))

Write a macro that addresses: Macro call that should be transformed by with-prepared-query

Macro definition:
(defmacro with-prepared-query (query (conn sql &key use-prepare-cached) &body body)
  `(call-with-prepared-query ,conn ,sql (lambda (,query) ,@body) :use-prepare-cached ,use-prepare-cached))

Macroexpansion:
(call-with-prepared-query *connection* sql (lambda (query) (let* ((query (with-trace-sql (execute-with-retry query binds))) (format (or format :plist)) (*plist-row-lispify* (if lispify-specified lispify (case format (:plist t) (otherwise nil))))) (retrieve-from-query query format))) :use-prepare-cached *use-prepare-cached*)
You are a Common Lisp macro expert. Given this code pattern:
(letv*)

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

Macro definition:
(defmacro LETV* ...)

Macroexpansion:
(block nil)
Define a macro that eliminates this repetitive pattern:
(do+ (for x (to 5)) (generating y (in #(0 1))) (collect (list x y)) (when (oddp x) (is (eql (try-update y) y))))

Issue: Macro call that should be transformed by do+

Macro definition:
(defmacro do+ (&body body)
  "High-level, extensible iteration construct. Refer to the manual for syntax and semantics."
  `(do+/internal nil ,@body))

Macroexpansion:
(do+/internal nil (for x (to 5)) (generating y (in #(0 1))) (collect (list x y)) (when (oddp x) (is (eql (try-update y) y))))
Create a Common Lisp macro for the following transformation. Before code:
(terminate-producing)

What needs to change: Macro call that should be transformed by TERMINATE-PRODUCING

Macro definition:
(defmacro TERMINATE-PRODUCING ...)

Macroexpansion:
(go end)
Generate a defmacro form that transforms code like this:
(defstore example (a b c))

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

Macro definition:
(defmacro defstore (store-name store-lambda-list &body body &environment env)
  (let* ((store-class-name (second (find :store-class body :key #'first)))
         (store-class (etypecase store-class-name
                        (null (find-class 'standard-store))
                        (symbol (find-class store-class-name))))
         (form (apply #'defstore-using-class store-class store-name store-lambda-list
                      :environment env
                      (mapcan #'(lambda (item)
                                  (cond ((eql (first item) :store-class)
                                         `(:store-class ',store-class-name))
                                        ((and (member (first item) '(:documentation :specialization-class)))
                                         (if (= 2 (length item))
                                             item
                                             (error "Invalid store definition option: ~W." item)))
                                        (t
                                         (list (first item) (rest item)))))
                              body))))
    `(eval-when (:compile-toplevel :load-toplevel :execute)
       ,form)))

Macroexpansion:
(eval-when (:compile-toplevel :load-toplevel :execute) (progn (ensure-store (quote example) (quote (a b c)))))
Generate a defmacro form that transforms code like this:
(doseq (item seq) (when (cl:zerop n) (return)) (accumulate c item) (cl:decf n))

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

Macro definition:
(defmacro doseq (name/seq &body body)
  "Iterate over the elements of a single sequence SEQUENCE.

   Same as DO-SEQUENCES but for the special case of iterating over a
   single sequence.

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

    1. (NAME (ELEMENT SEQUENCE &REST ARGS) &BODY BODY)

    2. ((ELEMENT SEQUENCE &REST ARGS) &BODY BODY)

   NAME is the block name, NIL if not given.

   ELEMENT is the variable to which each element of the sequence is
   bound.

   SEQUENCE is the sequence, with ARGS being the remaining arguments
   passed to the ITERATOR function.

   BODY is the list of forms evaluated on each iteration."

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

    (destructuring-bind (element sequence &rest args) seq
      `(do-sequences ,name
         ((,element ,sequence ,@args))
         ,@body))))

Macroexpansion:
(do-sequences nil ((item seq)) (when (zerop n) (return)) (accumulate c item) (decf n))
Write a Common Lisp macro to handle this code pattern:
(match nil)

Problem: Macro call that should be transformed by MATCH

Macro definition:
(defmacro MATCH ...)

Macroexpansion:
(match* (nil))
Generate a defmacro form that transforms code like this:
(macroexpand-convention (form) (if (consp form) (expand-metaclass-using-head (first form) metaclass form) form))

Pattern to recognize: Macro call that should be transformed by macroexpand-convention

Macro definition:
(defmacro macroexpand-convention ((original-form) &body body)
  "Executes BODY as like `progn' and return the result as the first
value.  As the second value, returns a boolean whether the result is
not same with ORIGINAL-FORM or not.
This macro is designed to follow the `macroexpand' convention."
  `(multiple-value-bind (result expanded-p)
       (progn ,@body)
     (values result
             (or expanded-p
                 (not (eq result ,original-form))))))

Macroexpansion:
(multiple-value-bind (result expanded-p) (progn (if (consp form) (expand-metaclass-using-head (first form) metaclass form) form)) (values result (or expanded-p (not (eq result form)))))
Define a macro that eliminates this repetitive pattern:
(-<>> nil :key nil)

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

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

Macroexpansion:
(->> (:key nil) nil)
Generate a defmacro form that transforms code like this:
(defstore naxpy (a x y))

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

Macro definition:
(defmacro defstore (store-name store-lambda-list &body body &environment env)
  (let* ((store-class-name (second (find :store-class body :key #'first)))
         (store-class (etypecase store-class-name
                        (null (find-class 'standard-store))
                        (symbol (find-class store-class-name))))
         (form (apply #'defstore-using-class store-class store-name store-lambda-list
                      :environment env
                      (mapcan #'(lambda (item)
                                  (cond ((eql (first item) :store-class)
                                         `(:store-class ',store-class-name))
                                        ((and (member (first item) '(:documentation :specialization-class)))
                                         (if (= 2 (length item))
                                             item
                                             (error "Invalid store definition option: ~W." item)))
                                        (t
                                         (list (first item) (rest item)))))
                              body))))
    `(eval-when (:compile-toplevel :load-toplevel :execute)
       ,form)))

Macroexpansion:
(eval-when (:compile-toplevel :load-toplevel :execute) (progn (ensure-store (quote naxpy) (quote (a x y)))))
Define a macro that eliminates this repetitive pattern:
(switch (13) ((+ 12 2) :oops) ((- 13 1) :oops2) (t :yay))

Issue: Macro call that should be transformed by switch

Macro definition:
(defmacro switch (&whole whole (object &key (test 'eql) (key 'identity))
                         &body clauses)
  "Evaluates first matching clause, returning its values, or evaluates and
returns the values of T or OTHERWISE if no keys match."
  (generate-switch-body whole object clauses test key))

Macroexpansion:
(let ((#:value130 (identity 13))) (cond ((eql #:value130 (+ 12 2)) :oops) ((eql #:value130 (- 13 1)) :oops2) (nil) (t (progn :yay))))
Write a Common Lisp macro to handle this code pattern:
(while nil
  nil)

Problem: Macro call that should be transformed by WHILE

Macro definition:
(defmacro WHILE ...)

Macroexpansion:
(loop while nil
      do (progn nil))
Define a macro that eliminates this repetitive pattern:
(with-slots nil
    nil)

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

Macro definition:
(defmacro WITH-SLOTS ...)

Macroexpansion:
(let ((#:g178 nil))
  (declare (ignorable #:g178))
  (declare (sb-pcl::%variable-rebinding #:g178 nil))
  (symbol-macrolet ()))
You are a Common Lisp macro expert. Given this code pattern:
(defstore foo (a b))

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

Macro definition:
(defmacro defstore (store-name store-lambda-list &body body &environment env)
  (let* ((store-class-name (second (find :store-class body :key #'first)))
         (store-class (etypecase store-class-name
                        (null (find-class 'standard-store))
                        (symbol (find-class store-class-name))))
         (form (apply #'defstore-using-class store-class store-name store-lambda-list
                      :environment env
                      (mapcan #'(lambda (item)
                                  (cond ((eql (first item) :store-class)
                                         `(:store-class ',store-class-name))
                                        ((and (member (first item) '(:documentation :specialization-class)))
                                         (if (= 2 (length item))
                                             item
                                             (error "Invalid store definition option: ~W." item)))
                                        (t
                                         (list (first item) (rest item)))))
                              body))))
    `(eval-when (:compile-toplevel :load-toplevel :execute)
       ,form)))

Macroexpansion:
(eval-when (:compile-toplevel :load-toplevel :execute) (progn (ensure-store (quote foo) (quote (a b)))))
Define a macro that eliminates this repetitive pattern:
(define L_tmpnam 16)

Issue: Macro call that should be transformed by define

Macro definition:
(defmacro define (name value &rest docstring)
  "Like a #define but also visible to Lisp code."
  `(progn
     (eval-when (:compile-toplevel :load-toplevel :execute)
       (defvar ,(pp-defines *package*) (make-hash-table))
       (setf (gethash ',name ,(pp-defines *package*)) ,(prin1-to-string value)))
     (defparameter ,name ,value ,@docstring)))

Macroexpansion:
(progn (eval-when (:compile-toplevel :load-toplevel :execute) (defvar *preprocessor-defines* (make-hash-table)) (setf (gethash (quote l_tmpnam) *preprocessor-defines*) #A((2) base-char . "16"))) (defparameter l_tmpnam 16))
Define a macro that eliminates this repetitive pattern:
(define-fixture-restore variable (symbol value) (setf (symbol-value symbol) value))

Issue: Macro call that should be transformed by define-fixture-restore

Macro definition:
(defmacro define-fixture-restore (name args &body body)
  `(progn (setf (gethash ',name *fixture-restores*)
                (lambda ,args ,@body))
          ',name))

Macroexpansion:
(progn (setf (gethash (quote variable) *fixture-restores*) (lambda (symbol value) (setf (symbol-value symbol) value))) (quote variable))
Create a Common Lisp macro for the following transformation. Before code:
(sum-of nil
  (progn))

What needs to change: Macro call that should be transformed by SUM-OF

Macro definition:
(defmacro SUM-OF ...)

Macroexpansion:
(lc (nil (progn)) sum)
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

Macro definition:
(defmacro DEFGENERIC ...)

Macroexpansion:
(progn
 (eval-when (:compile-toplevel)
   (common-lisp:defgeneric nil
       nil))
 (eval-when (:load-toplevel :execute)
   (common-lisp:defgeneric nil
       nil)))
Generate a defmacro form that transforms code like this:
(defstore example (x &rest args))

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

Macro definition:
(defmacro defstore (store-name store-lambda-list &body body &environment env)
  (let* ((store-class-name (second (find :store-class body :key #'first)))
         (store-class (etypecase store-class-name
                        (null (find-class 'standard-store))
                        (symbol (find-class store-class-name))))
         (form (apply #'defstore-using-class store-class store-name store-lambda-list
                      :environment env
                      (mapcan #'(lambda (item)
                                  (cond ((eql (first item) :store-class)
                                         `(:store-class ',store-class-name))
                                        ((and (member (first item) '(:documentation :specialization-class)))
                                         (if (= 2 (length item))
                                             item
                                             (error "Invalid store definition option: ~W." item)))
                                        (t
                                         (list (first item) (rest item)))))
                              body))))
    `(eval-when (:compile-toplevel :load-toplevel :execute)
       ,form)))

Macroexpansion:
(eval-when (:compile-toplevel :load-toplevel :execute) (progn (ensure-store (quote example) (quote (x &rest args)))))
Create a Common Lisp macro for the following transformation. Before code:
(compile-$flavor-$methods nil :key nil)

What needs to change: Macro call that should be transformed by COMPILE-$FLAVOR-$METHODS

Macro definition:
(defmacro COMPILE-$FLAVOR-$METHODS ...)

Macroexpansion:
(eval-when (:load-toplevel) (combine-class-methods nil :key nil))
Create a Common Lisp macro for the following transformation. Before code:
(defstore example (object &rest args))

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

Macro definition:
(defmacro defstore (store-name store-lambda-list &body body &environment env)
  (let* ((store-class-name (second (find :store-class body :key #'first)))
         (store-class (etypecase store-class-name
                        (null (find-class 'standard-store))
                        (symbol (find-class store-class-name))))
         (form (apply #'defstore-using-class store-class store-name store-lambda-list
                      :environment env
                      (mapcan #'(lambda (item)
                                  (cond ((eql (first item) :store-class)
                                         `(:store-class ',store-class-name))
                                        ((and (member (first item) '(:documentation :specialization-class)))
                                         (if (= 2 (length item))
                                             item
                                             (error "Invalid store definition option: ~W." item)))
                                        (t
                                         (list (first item) (rest item)))))
                              body))))
    `(eval-when (:compile-toplevel :load-toplevel :execute)
       ,form)))

Macroexpansion:
(eval-when (:compile-toplevel :load-toplevel :execute) (progn (ensure-store (quote example) (quote (object &rest args)))))
Define a macro that eliminates this repetitive pattern:
(keep-bops)

Issue: 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 t
     (setq *binfix*
             (delete nil
                     (mapcar
                      (lambda (bs)
                        (setq bs
                                (delete-if
                                 (lambda (b)
                                   (unless (member (car b) 'nil)
                                     (remprop (car b) 'properties)
                                     t))
                                 bs)))
                      *binfix*)))
     (assign-properties))))
Write a Common Lisp macro to handle this code pattern:
(define-global-var* nil :key nil)

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

Macro definition:
(defmacro DEFINE-GLOBAL-VAR* ...)

Macroexpansion:
(sb-ext:define-load-time-global nil :key nil)
Generate a defmacro form that transforms code like this:
(next-in 'some-name)

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

Macro definition:
(defmacro NEXT-IN ...)

Macroexpansion:
(do-next-in 'some-name #'(lambda ()))
Generate a defmacro form that transforms code like this:
(enable-quasi-quoted-string-to-string-emitting-form-syntax nil)

Pattern to recognize: Macro call that should be transformed by ENABLE-QUASI-QUOTED-STRING-TO-STRING-EMITTING-FORM-SYNTAX

Macro definition:
(defmacro ENABLE-QUASI-QUOTED-STRING-TO-STRING-EMITTING-FORM-SYNTAX ...)

Macroexpansion:
(eval-when (:compile-toplevel :execute)
  (setf *readtable* (copy-readtable *readtable*))
  (set-quasi-quoted-string-to-string-emitting-form-syntax-in-readtable nil
                                                                       :with-inline-emitting
                                                                       nil
                                                                       :declarations
                                                                       'nil
                                                                       :start-character
                                                                       nil
                                                                       :end-character
                                                                       nil
                                                                       :unquote-character
                                                                       #\COMMA
                                                                       :splice-character
                                                                       #\COMMERCIAL_AT
                                                                       :destructive-splice-character
                                                                       #\FULL_STOP
                                                                       :dispatched-quasi-quote-name
                                                                       "str")
  (values))
Write a Common Lisp macro to handle this code pattern:
(define-mustache-character #\/ (make-instance 'section-end-tag :text arg-text :start start))

Problem: Macro call that should be transformed by define-mustache-character

Macro definition:
(defmacro define-mustache-character (char &body body)
  `(set-mustache-character
    ,char (lambda (raw-text arg-text escapep start end)
            (declare (ignorable raw-text arg-text escapep start end)
                     (type simple-string raw-text arg-text)
                     (boolean escapep)
                     (offset start end))
            ,@body)))

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