j14i/cl-macros huggingface dataset:
Write a Common Lisp macro to handle this code pattern:
(define-element-maker :pattern "pattern" '(:id))

Problem: Macro call that should be transformed by define-element-maker

Macro definition:
(defmacro define-element-maker (element name required-attributes)
  `(progn
     (defmethod assert-required-attributes ((element (eql ,element)) attributes)
       (declare (ignore element))
       (unless (evenp (length attributes))
         (warn "attribute list may be missing data: ~A" attributes))
       (let ((missing (set-difference ,required-attributes attributes)))
	 (when missing
	   (error 'missing-attributes :message (format nil "~A missing attributes: ~{~A~^ ~}" ,element missing)))))
     (defmethod make-svg-element ((element (eql ,element)) attributes)
       (when *check-required-attributes*
         (assert-required-attributes element attributes))
       (make-instance 'svg-element :name ,name :attributes attributes))))

Macroexpansion:
(progn (defmethod assert-required-attributes ((element (eql :pattern)) attributes) (declare (ignore element)) (unless (evenp (length attributes)) (warn "attribute list may be missing data: ~A" attributes)) (let ((missing (set-difference (quote (:id)) attributes))) (when missing (error (quote missing-attributes) :message (format nil "~A missing attributes: ~{~A~^ ~}" :pattern missing))))) (defmethod make-svg-element ((element (eql :pattern)) attributes) (when *check-required-attributes* (assert-required-attributes element attributes)) (make-instance (quote svg-element) :name "pattern" :attributes attributes)))
Create a Common Lisp macro for the following transformation. Before code:
(lambda () :key nil)

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

Macro definition:
(defmacro LAMBDA ...)

Macroexpansion:
#'(lambda () :key nil)
Generate a defmacro form that transforms code like this:
(sum-of 'some-name)

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

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

Macroexpansion:
(lc ('some-name) sum)
You are a Common Lisp macro expert. Given this code pattern:
(c? (* 2 (or (^m-ephem-a) 0)))

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:
(make-c-dependent :code (quote ((* 2 (or (^m-ephem-a) 0)))) :value-state :unevaluated :rule (c-lambda (* 2 (or (^m-ephem-a) 0))))
Generate a defmacro form that transforms code like this:
(match0 form ((cons a b) `(cons ,(type-of-quoted-form a) ,(type-of-quoted-form b))) (_ (typecase form ((or symbol number character) `(eql ,form)) (t (type-of form)))))

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

Macro definition:
(defmacro match0 (*what* &body clauses &environment *env*)
  (once-only (*what*)
    (parse-patterns clauses)))

Macroexpansion:
(let ((#:*what*161 form)) (declare (ignorable #:*what*161)) (if (and (consp #:*what*161) (let ((#:*what*162 (car #:*what*161))) (declare (ignorable #:*what*162)) t) (let ((#:*what*163 (cdr #:*what*161))) (declare (ignorable #:*what*163)) t)) (let* ((#:*what*162 (car #:*what*161)) (a #:*what*162) (#:*what*163 (cdr #:*what*161)) (b #:*what*163)) (declare (ignorable b #:*what*163 a #:*what*162)) (sb-int:quasiquote (cons #S(sb-impl::comma :expr (type-of-quoted-form a) :kind 0) #S(sb-impl::comma :expr (type-of-quoted-form b) :kind 0)))) (if t (let* nil (declare (ignorable)) (typecase form ((or symbol number character) (sb-int:quasiquote (eql #S(sb-impl::comma :expr form :kind 0)))) (t (type-of form)))) nil)))
You are a Common Lisp macro expert. Given this code pattern:
(ifmatch nil
    :key
    nil)

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

Macro definition:
(defmacro IFMATCH ...)

Macroexpansion:
(match :key (nil nil) (_))
Write a Common Lisp macro to handle this code pattern:
(with-wcs-math-error-handling (ret (fround x)) (check-wcs-math-result))

Problem: 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* ((#:g248 x) (#:g249 nil) (#:g250 (list #:g248))) (declare (ignorable #:g249) (type list #:g250) (dynamic-extent #:g250)) (catch (quote return-from-with-wcs-math-error-handling) (multiple-value-bind (ret) (call-with-wcs-math-error-handler (quote fround) #:g250) (flet ((check-wcs-math-result (&optional (ret ret) (arg-list #:g250)) (check-wcs-math-result ret arg-list))) (check-wcs-math-result)))))
Define a macro that eliminates this repetitive pattern:
(with-component-testers (a b #'pathname-version) (and (null a) (null b)) (components-are-member '(:wild :newest :unspecific)) (and (integerp a) (integerp b) (= a b)))

Issue: Macro call that should be transformed by with-component-testers

Macro definition:
(defmacro with-component-testers ((a b key) &body body)
  (let ((k (gensym)))
    `(let* ((,k ,key)
            (,a (funcall ,k ,a))
            (,b (funcall ,k ,b)))
       (labels ((components-are (test)
                  (and (funcall test ,a) (funcall test ,b)))
                (components-are-member (values)
                  (and (member ,a values :test #'eql)
                       (member ,b values :test #'eql)
                       (eql ,a ,b)))
                (components-are-string= ()
                  (and (stringp ,a) (stringp ,b) (string= ,a ,b)))
                (components-are-every (test)
                  (and (consp ,a)
                       (consp ,b)
                       (every test ,a ,b))))
         (declare (ignorable #'components-are #'components-are-member
                             #'components-are-string= #'components-are-every))
         (if (or ,@body)
             (values t ,a ,b)
             nil)))))

Macroexpansion:
(let* ((#:g148 (function pathname-version)) (a (funcall #:g148 a)) (b (funcall #:g148 b))) (labels ((components-are (test) (and (funcall test a) (funcall test b))) (components-are-member (values) (and (member a values :test (function eql)) (member b values :test (function eql)) (eql a b))) (components-are-string= nil (and (stringp a) (stringp b) (string= a b))) (components-are-every (test) (and (consp a) (consp b) (every test a b)))) (declare (ignorable (function components-are) (function components-are-member) (function components-are-string=) (function components-are-every))) (if (or (and (null a) (null b)) (components-are-member (quote (:wild :newest :unspecific))) (and (integerp a) (integerp b) (= a b))) (values t a b) nil)))
Define a macro that eliminates this repetitive pattern:
(define-bug return-set-mismatch () (form) "Type & Return sets don't match Our apologies for this mistake. If you have the time please raise an issue at https://github.com/cbaggers/varjo/issues including the code that triggered this issue. Problematic Definition: ~s" form)

Issue: Macro call that should be transformed by define-bug

Macro definition:
(defmacro define-bug (name (&key (error-type 'varjo-error) (prefix "Varjo Bug"))
                            (&rest args) error-string &body body)
  `(defcondition ,name (:error-type ,error-type :prefix ,prefix) ,args
       ,error-string ,@body))

Macroexpansion:
(defcondition return-set-mismatch (:error-type varjo-error :prefix "Varjo Bug") (form) "Type & Return sets don't match Our apologies for this mistake. If you have the time please raise an issue at https://github.com/cbaggers/varjo/issues including the code that triggered this issue. Problematic Definition: ~s" form)
Generate a defmacro form that transforms code like this:
(js-inline 'some-name)

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

Macro definition:
(defmacro JS-INLINE ...)

Macroexpansion:
(js-inline* '(progn 'some-name))
Generate a defmacro form that transforms code like this:
(define-symbol-macro nil (progn))

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

Macro definition:
(defmacro DEFINE-SYMBOL-MACRO ...)

Macroexpansion:
(eval-when (:compile-toplevel :load-toplevel :execute)
  (sb-c::%define-symbol-macro 'nil '(progn) (sb-c:source-location)))
Generate a defmacro form that transforms code like this:
(augment-lexenv! :variable environment-var lexenv)

Pattern to recognize: Macro call that should be transformed by augment-lexenv!

Macro definition:
(defmacro augment-lexenv! (kind name env &rest other-datum)
  `(setf ,env (augment-lexenv ,kind ,name ,env ,@other-datum)))

Macroexpansion:
(setf lexenv (augment-lexenv :variable environment-var lexenv))
Generate a defmacro form that transforms code like this:
(ps-inline 'some-name)

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

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

Macroexpansion:
(concatenate 'string "javascript:" "\"someName\"")
Write a Common Lisp macro to handle this code pattern:
(sif (car x) (setf it :yes!) (setf it :oops))

Problem: Macro call that should be transformed by sif

Macro definition:
(defmacro sif (test then &optional else)
  "Like IF, except binds the test form to IT (via SYMBOL-MACROLET) for
the scope of the then and else expressions. IT can be set with SETF"
  `(symbolic if ,test ,then ,else))

Macroexpansion:
(symbolic if (car x) (setf it :yes!) (setf it :oops))
Generate a defmacro form that transforms code like this:
(define-simple-type-map macro cl:macro-function)

Pattern to recognize: Macro call that should be transformed by define-simple-type-map

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

Macroexpansion:
(defmethod type ((macro macro)) (quote macro-function))
You are a Common Lisp macro expert. Given this code pattern:
(none-of nil
  nil)

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

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

Macroexpansion:
(lc (nil nil) never)
Write a Common Lisp macro to handle this code pattern:
(gather-result 'some-name)

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

Macro definition:
(defmacro GATHER-RESULT ...)

Macroexpansion:
(common-lisp:funcall 'some-name nil t)
Create a Common Lisp macro for the following transformation. Before code:
(with-preprocessor-state-slots (state) (unless if-section-stack (error 'preprocess-error :format-control "#~A appeared outside of #if section." :format-arguments (list (symbol-name directive-symbol)))))

What needs to change: Macro call that should be transformed by with-preprocessor-state-slots

Macro definition:
(defmacro with-preprocessor-state-slots ((state) &body body)
  `(with-accessors ((file-pathname pp-state-file-pathname)
                    (token-list pp-state-token-list)
                    (result-list pp-state-result-list)
                    (line-number pp-state-line-number)
                    (tokens-in-line pp-state-tokens-in-line)
                    (macro-alist pp-state-macro-alist)
                    (if-section-stack pp-state-if-section-stack)
                    (if-section-skip-reason pp-state-if-section-skip-reason)
                    (include-stack pp-state-include-stack))
       ,state
     ,@body))

Macroexpansion:
(with-accessors ((file-pathname pp-state-file-pathname) (token-list pp-state-token-list) (result-list pp-state-result-list) (line-number pp-state-line-number) (tokens-in-line pp-state-tokens-in-line) (macro-alist pp-state-macro-alist) (if-section-stack pp-state-if-section-stack) (if-section-skip-reason pp-state-if-section-skip-reason) (include-stack pp-state-include-stack)) state (unless if-section-stack (error (quote preprocess-error) :format-control "#~A appeared outside of #if section." :format-arguments (list (symbol-name directive-symbol)))))
Generate a defmacro form that transforms code like this:
(do-generators ((g (some-numbers)) (:list l data)) (yield (+ l g)))

Pattern to recognize: Macro call that should be transformed by do-generators

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

Macroexpansion:
(let ((#:g129 (multi-gen (some-numbers) (list->generator data)))) (loop do (destructuring-bind (#:g131 . #:g130) (multiple-value-list (next-generator-value #:g129)) (unless #:g131 (return)) (let ((g (elt (elt #:g130 0) 0)) (l (elt (elt #:g130 1) 0))) (yield (+ l g))))))
Generate a defmacro form that transforms code like this:
(lambda () (progn))

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

Macro definition:
(defmacro LAMBDA ...)

Macroexpansion:
#'(lambda () (progn))
You are a Common Lisp macro expert. Given this code pattern:
(define-bug nil-emit-set () (form possible-set) "Could not establish emit-set. Our apologies for this mistake. If you have the time please raise an issue at https://github.com/cbaggers/varjo/issues including the code that triggered this issue. Problematic form: ~a Possible Set: ~a" form possible-set)

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

Macro definition:
(defmacro define-bug (name (&key (error-type 'varjo-error) (prefix "Varjo Bug"))
                            (&rest args) error-string &body body)
  `(defcondition ,name (:error-type ,error-type :prefix ,prefix) ,args
       ,error-string ,@body))

Macroexpansion:
(defcondition nil-emit-set (:error-type varjo-error :prefix "Varjo Bug") (form possible-set) "Could not establish emit-set. Our apologies for this mistake. If you have the time please raise an issue at https://github.com/cbaggers/varjo/issues including the code that triggered this issue. Problematic form: ~a Possible Set: ~a" form possible-set)
Define a macro that eliminates this repetitive pattern:
(defmacro nil (progn))

Issue: Macro call that should be transformed by DEFMACRO

Macro definition:
(defmacro DEFMACRO ...)

Macroexpansion:
(progn
 (eval-when (:compile-toplevel)
   (sb-c::%compiler-defmacro :macro-function 'nil))
 (eval-when (:compile-toplevel :load-toplevel :execute)
   (sb-c::%defmacro 'nil
                    (sb-int:named-lambda (macro-function nil)
                        (#:expr #:env)
                      (declare (sb-c::lambda-list (progn)))
                      (declare (ignore #:env))
                      (sb-int:named-ds-bind (:macro nil . defmacro)
                          (progn)
                          (cdr #:expr)
                        (declare (sb-c::constant-value progn))))
                    (sb-c:source-location))))
Generate a defmacro form that transforms code like this:
(who-ps-html nil :key nil)

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

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

Macroexpansion:
(stringify nil #A((11) base-char . "<key></key>") nil)
Write a Common Lisp macro to handle this code pattern:
(fgatherlet nil)

Problem: Macro call that should be transformed by FGATHERLET

Macro definition:
(defmacro FGATHERLET ...)

Macroexpansion:
(flet nil)
Write a Common Lisp macro to handle this code pattern:
(define-error setq-readonly () (var-name code) "You cannot setq ~a as it is readonly ~%This was attempted as follows ~a" var-name code)

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

Macro definition:
(defmacro define-error (name (&key (error-type 'varjo-error) (prefix "Varjo"))
                            (&rest args) error-string &body body)
  `(defcondition ,name (:error-type ,error-type :prefix ,prefix) ,args
       ,error-string ,@body))

Macroexpansion:
(defcondition setq-readonly (:error-type varjo-error :prefix "Varjo") (var-name code) "You cannot setq ~a as it is readonly ~%This was attempted as follows ~a" var-name code)
You are a Common Lisp macro expert. Given this code pattern:
(->>
  'some-name)

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

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

Macroexpansion:
'some-name
You are a Common Lisp macro expert. Given this code pattern:
(*> #'space #'rest)

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

Macro definition:
(defmacro *> (parser &rest parsers)
  "Combination of parsers yielding the result of the rightmost one."
  (let ((offset (gensym "*>-OFFSET")))
    `(lambda (,offset)
       ,(reduce (lambda (i p)
                  (let ((res  (gensym "*>-RES"))
                        (next (gensym "*>-NEXT")))
                    `(multiple-value-bind (,res ,next) ,i
                       (if (ok? ,res)
                           (funcall ,p ,next)
                           (fail ,next)))))
                parsers
                :initial-value `(funcall ,parser ,offset)))))

Macroexpansion:
(lambda (#:*>-offset218) (multiple-value-bind (#:*>-res219 #:*>-next220) (funcall (function space) #:*>-offset218) (if (ok? #:*>-res219) (funcall (function rest) #:*>-next220) (fail #:*>-next220))))
Define a macro that eliminates this repetitive pattern:
(let-syntax common-lisp:nil common-lisp:nil)

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

Macro definition:
(defmacro LET-SYNTAX ...)

Macroexpansion:
(common-lisp:progn common-lisp:nil)
Generate a defmacro form that transforms code like this:
(aand (incf x) t t (values t it))

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

Macro definition:
(defmacro aand (first &rest rest)
  "Like AND, except binds the first argument to IT (via LET) for the
scope of the rest of the arguments."
  `(anaphoric and ,first ,@rest))

Macroexpansion:
(anaphoric and (incf x) t t (values t it))
Generate a defmacro form that transforms code like this:
(defclause-sequence nil nil)

Pattern to recognize: Macro call that should be transformed by DEFCLAUSE-SEQUENCE

Macro definition:
(defmacro DEFCLAUSE-SEQUENCE ...)

Macroexpansion:
(progn nil nil)
Create a Common Lisp macro for the following transformation. Before code:
(dlet 'some-name)

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

Macro definition:
(defmacro DLET ...)

Macroexpansion:
(dynamic-let 'some-name)
You are a Common Lisp macro expert. Given this code pattern:
(signal-syntax-error "Invalid range from ~S to ~S in char-class." from to)

Write a macro that addresses: Macro call that should be transformed by signal-syntax-error

Macro definition:
(defmacro signal-syntax-error (format-control &rest format-arguments)
  `(signal-syntax-error* nil ,format-control ,@format-arguments))

Macroexpansion:
(signal-syntax-error* nil "Invalid range from ~S to ~S in char-class." from to)
You are a Common Lisp macro expert. Given this code pattern:
(m nil
  nil)

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

Macro definition:
(defmacro M ...)

Macroexpansion:
(lambda (&rest #:|macro-lambda-list121|)
  (destructuring-bind () #:|macro-lambda-list121| nil))
Write a Common Lisp macro to handle this code pattern:
(quasiquote-expand (progn (unread-char #\( stream) (read-preserving-whitespace stream t nil t))))

Problem: Macro call that should be transformed by quasiquote

Macro definition:
(defmacro quasiquote (x) (quasiquote-expand x))

Macroexpansion:
(quasiquote-expand (progn (unread-char #\LEFT_PARENTHESIS stream) (read-preserving-whitespace stream t nil t)))
Define a macro that eliminates this repetitive pattern:
(with-unique-names (value) (values `((,name (,value) (incf ,var ,value))) `((inline ,name))))

Issue: Macro call that should be transformed by with-unique-names

Macro definition:
(defmacro with-unique-names (names &body body)
  `(let ,(mapcar (lambda (sym)
                   `(,sym (gensym ,(symbol-name sym))))
                  names)
     ,@body))

Macroexpansion:
(let ((value (gensym #A((5) base-char . "VALUE")))) (values (quasiquote ((#S(sb-impl::comma :expr name :kind 0) (#S(sb-impl::comma :expr value :kind 0)) (incf #S(sb-impl::comma :expr var :kind 0) #S(sb-impl::comma :expr value :kind 0))))) (quasiquote ((inline #S(sb-impl::comma :expr name :kind 0))))))
You are a Common Lisp macro expert. Given this code pattern:
(dynamic-relet nil
  nil)

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

Macro definition:
(defmacro DYNAMIC-RELET ...)

Macroexpansion:
(dynamic-wind
  :proceed
  #:proceed189
  (let ()
    (declare (special))
    (#:proceed189 nil)))
Write a Common Lisp macro to handle this code pattern:
(deferror "08004" sqlserver-rejected-establishment-of-sqlconnection)

Problem: Macro call that should be transformed by deferror

Macro definition:
(defmacro deferror (code typename &optional (superclass 'database-error))
  `(progn (define-condition ,typename (,superclass) ())
          (setf (gethash ,code *error-table*) ',typename)))

Macroexpansion:
(progn (define-condition sqlserver-rejected-establishment-of-sqlconnection (database-error) nil) (setf (gethash "08004" *error-table*) (quote sqlserver-rejected-establishment-of-sqlconnection)))
Create a Common Lisp macro for the following transformation. Before code:
(make-$instance 'some-name)

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

Macro definition:
(defmacro MAKE-$INSTANCE ...)

Macroexpansion:
(let ((class (symbol-value 'some-name)))
  (funcall (mcs-slot-value class (index-of-basicnew-fn)) class))
Write a Common Lisp macro to handle this code pattern:
(eswitch ((first feature-expression) :test 'string=) (:and (every #'featurep (rest feature-expression))) (:or (some #'featurep (rest feature-expression))) (:not (assert (= 2 (length feature-expression))) (not (featurep (second feature-expression)))))

Problem: Macro call that should be transformed by eswitch

Macro definition:
(defmacro eswitch (&whole whole (object &key (test 'eql) (key 'identity))
                          &body clauses)
  "Like SWITCH, but signals an error if no key matches."
  (generate-switch-body whole object clauses test key '(error)))

Macroexpansion:
(let ((#:value131 (identity (first feature-expression)))) (cond ((string= #:value131 :and) (every (function featurep) (rest feature-expression))) ((string= #:value131 :or) (some (function featurep) (rest feature-expression))) ((string= #:value131 :not) (assert (= 2 (length feature-expression))) (not (featurep (second feature-expression)))) (t (error "No keys match in SWITCH. Testing against ~S with ~S." #:value131 (quote string=)))))