j14i/cl-macros huggingface dataset:
Write a Common Lisp macro to handle this code pattern:
(iterate 'some-name)

Problem: Macro call that should be transformed by ITERATE

Macro definition:
(defmacro ITERATE ...)

Macroexpansion:
(common-lisp:let* ((#:generator-265 (generator nil))
                   #:m-259
                   (#:generator-263 (generator nil))
                   #:m-260)
  (declare (type generator #:generator-265)
           (type generator #:generator-263))
  (tagbody
   #:ll-266
    (setq #:m-259 (next-in #:generator-265 (go end)))
    (setq #:m-260 (next-in #:generator-263 (go end)))
    ((lambda (quote some-name)) #:m-260 #:m-259)
    (go #:ll-266)
   end)
  nil)
Generate a defmacro form that transforms code like this:
(producing 'some-name)

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

Macro definition:
(defmacro PRODUCING ...)

Macroexpansion:
(non-opt-producing 'some-name)
Generate a defmacro form that transforms code like this:
(defun/1 ceil (x) (ceiling x))

Pattern to recognize: Macro call that should be transformed by defun/1

Macro definition:
(defmacro defun/1 (name arglist &body body)
  "Lisp-1 defun; makes function pointers work."
  `(progn
     (defun ,name ,arglist
       (declare (optimize (speed 0) (debug 3)
                          ;; FIXME: Why do minor warnings result in load errors?
                          #+sbcl (sb-ext:inhibit-warnings 3)))
        
       ,@body)
     (defparameter ,name (vacietis.c:mkptr& (symbol-function ',name)))))

Macroexpansion:
(progn (defun ceil (x) (declare (optimize (speed 0) (debug 3) (sb-ext:inhibit-warnings 3))) (ceiling x)) (defparameter ceil (vacietis.c:mkptr& (symbol-function (quote ceil)))))
Create a Common Lisp macro for the following transformation. Before code:
(define-modf-rewrite ninth (expr) `(car (cddddr (cddddr ,(second expr)))))

What needs to change: 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 ninth) *modf-rewrites*) (lambda (expr) (sb-int:quasiquote (car (cddddr (cddddr #S(sb-impl::comma :expr (second expr) :kind 0))))))))
Define a macro that eliminates this repetitive pattern:
(defstore nhadamard-product (y x &key (a 1)))

Issue: 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 nhadamard-product) (quote (y x &key (a 1 #:a?151))))))
Create a Common Lisp macro for the following transformation. Before code:
(with-wcs-math-error-handling (ret (fceiling x)) (check-wcs-math-result))

What needs to change: Macro call that should be transformed by with-wcs-math-error-handling

Macro definition:
(defmacro with-wcs-math-error-handling
    ((var-or-var-list
      (function x &optional (y nil y-supplied-p))
      &rest keyargs
      &key underflow-value)
     &body body)
  (declare (ignorable underflow-value))
  (let ((x_ (gensym)) (y_ (gensym)) (args_ (gensym))
        (var-list (ensure-list var-or-var-list)))
    `(let* ((,x_ ,x)
            (,y_ ,y)
            (,args_ (list ,x_ ,@(if y-supplied-p `(,y_)))))
       (declare (ignorable ,y_)
                (type list ,args_)
                (dynamic-extent ,args_))
       (catch 'return-from-with-wcs-math-error-handling
         (multiple-value-bind ,var-list
             (call-with-wcs-math-error-handler ',function ,args_
                                               ,@keyargs)
           (flet ((check-wcs-math-result
                      (&optional (ret ,(first var-list))
                                 (arg-list ,args_))
                    (check-wcs-math-result ret arg-list)))
             ,@body))))))

Macroexpansion:
(let* ((#:g242 x) (#:g243 nil) (#:g244 (list #:g242))) (declare (ignorable #:g243) (type list #:g244) (dynamic-extent #:g244)) (catch (quote return-from-with-wcs-math-error-handling) (multiple-value-bind (ret) (call-with-wcs-math-error-handler (quote fceiling) #:g244) (flet ((check-wcs-math-result (&optional (ret ret) (arg-list #:g244)) (check-wcs-math-result ret arg-list))) (check-wcs-math-result)))))
Create a Common Lisp macro for the following transformation. Before code:
(define-modf-rewrite caaddr (expr) `(car (caddr ,(second expr))))

What needs to change: 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 caaddr) *modf-rewrites*) (lambda (expr) (sb-int:quasiquote (car (caddr #S(sb-impl::comma :expr (second expr) :kind 0)))))))