j14i/cl-macros huggingface dataset:
Create a Common Lisp macro for the following transformation. Before code:
(without-symbol-access
  'some-name)

What needs to change: Macro call that should be transformed by WITHOUT-SYMBOL-ACCESS

Macro definition:
(defmacro WITHOUT-SYMBOL-ACCESS ...)

Macroexpansion:
(let ((*symbol-access* nil))
  'some-name)
Create a Common Lisp macro for the following transformation. Before code:
(mvlet 'some-name)

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

Macro definition:
(defmacro MVLET ...)

Macroexpansion:
(progn (let ((quote) (some-name))))
Create a Common Lisp macro for the following transformation. Before code:
(with-preprocessor-state-slots (state) (let ((removed-if-section (pop if-section-stack))) (when (eq if-section-skip-reason removed-if-section) (setf if-section-skip-reason nil))))

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 (let ((removed-if-section (pop if-section-stack))) (when (eq if-section-skip-reason removed-if-section) (setf if-section-skip-reason nil))))
Define a macro that eliminates this repetitive pattern:
(ok nil "This supposed to be failed")

Issue: Macro call that should be transformed by ok

Macro definition:
(defmacro ok (test &optional desc)
  (with-gensyms (duration result)
    (once-only (test desc)
      `(with-catching-errors (:expected T :description ,desc)
         (with-duration ((,duration ,result) ,test)
           (test ,result t ,desc
                 :duration ,duration
                 :test-fn (lambda (x y)
                            (eq (not (null x)) y))
                 :got-form ,test))))))

Macroexpansion:
(let ((#:test150 nil) (#:desc151 "This supposed to be failed")) (with-catching-errors (:expected t :description #:desc151) (with-duration ((#:duration148 #:result149) #:test150) (test #:result149 t #:desc151 :duration #:duration148 :test-fn (lambda (x y) (eq (not (null x)) y)) :got-form #:test150))))
Define a macro that eliminates this repetitive pattern:
(vect-of 'some-name)

Issue: Macro call that should be transformed by VECT-OF

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

Macroexpansion:
(let ((#:vect141 (make-array 10 :adjustable t :fill-pointer 0)))
  (do-for nil
    (vector-push-extend 'some-name #:vect141))
  #:vect141)
Define a macro that eliminates this repetitive pattern:
(when nil :key nil)

Issue: Macro call that should be transformed by WHEN

Macro definition:
(defmacro WHEN ...)

Macroexpansion:
(if nil
    (progn :key nil))
Create a Common Lisp macro for the following transformation. Before code:
(defun-advisable nil
    :key
  nil)

What needs to change: Macro call that should be transformed by DEFUN-ADVISABLE

Macro definition:
(defmacro DEFUN-ADVISABLE ...)

Macroexpansion:
(let ((#:oldfn136
       (handler-case (symbol-function 'nil) (undefined-function nil nil))))
  (defun nil :key nil)
  (make-advisable 'nil :arguments ':key)
  (when
      (and #:oldfn136
           (not (eql (advisable-function-arguments #:oldfn136) :not-provided))
           (equal (advisable-function-arguments #:oldfn136) ':key))
    (copy-advice #:oldfn136 (symbol-function 'nil))))
Create a Common Lisp macro for the following transformation. Before code:
(defun-compile-time walk-progn (map-function reduce-function screamer? partial? nested? form environment) (unless (null (rest (last form))) (error "Improper PROGN: ~S" form)) (if reduce-function (funcall reduce-function (funcall map-function form 'progn) (reduce reduce-function (mapcar #'(lambda (subform) (walk map-function reduce-function screamer? partial? nested? subform environment)) (rest form)))) (funcall map-function form 'progn)))

What needs to change: 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 walk-progn (map-function reduce-function screamer? partial? nested? form environment) (unless (null (rest (last form))) (error "Improper PROGN: ~S" form)) (if reduce-function (funcall reduce-function (funcall map-function form (quote progn)) (reduce reduce-function (mapcar (function (lambda (subform) (walk map-function reduce-function screamer? partial? nested? subform environment))) (rest form)))) (funcall map-function form (quote progn)))) (eval-when (:compile-toplevel) (compile (quote walk-progn))))
Generate a defmacro form that transforms code like this:
(count-of nil
  nil)

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

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

Macroexpansion:
(lc (nil nil) count)
Define a macro that eliminates this repetitive pattern:
(defclause accumulating-to-and-returning (vars &rest args &key initially by finally) "Same as accumulating-into, but also returns the value of each <vars> at the end of the loop." (declare (ignore initially by finally)) `((accumulating-to ,vars ,@args) ,@(mapcar (lambda (var) `(returning ,var)) (ensure-list vars))))

Issue: Macro call that should be transformed by defclause

Macro definition:
(defmacro defclause (name arglist &body body)
  "Same as cl:defmacro, but additionally records <name> in *clauses* as a known clause macro."
  `(progn
     (defmacro ,name ,arglist ,@body)
     (pushnew ',name *clauses*)))

Macroexpansion:
(progn (defmacro accumulating-to-and-returning (vars &rest args &key initially by finally) "Same as accumulating-into, but also returns the value of each <vars> at the end of the loop." (declare (ignore initially by finally)) (sb-int:quasiquote ((accumulating-to #S(sb-impl::comma :expr vars :kind 0) #S(sb-impl::comma :expr args :kind 2)) #S(sb-impl::comma :expr (mapcar (lambda (var) (sb-int:quasiquote (returning #S(sb-impl::comma :expr var :kind 0)))) (ensure-list vars)) :kind 2)))) (pushnew (quote accumulating-to-and-returning) *clauses*))
You are a Common Lisp macro expert. Given this code pattern:
(defstruct*)

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

Macro definition:
(defmacro DEFSTRUCT* ...)

Macroexpansion:
(progn
 (defclass nil nil nil)
 (defun make-nil (&rest structure-ext.as-class::args)
   (apply #'make-instance 'nil structure-ext.as-class::args))
 (defgeneric copy-nil
     (structure-ext.as-class::arg))
 (defmethod copy-nil ((structure-ext.as-class::arg nil))
   (let ((structure-ext.as-class::obj
          (make-instance (class-of structure-ext.as-class::arg))))
     (dolist
         (structure-ext.as-class::slot
          (structure-ext.as-class::slots<=obj structure-ext.as-class::arg))
       (if (slot-boundp structure-ext.as-class::arg
                        structure-ext.as-class::slot)
           (setf (slot-value structure-ext.as-class::obj
                             structure-ext.as-class::slot)
                   (slot-value structure-ext.as-class::arg
                               structure-ext.as-class::slot))
           (slot-makunbound structure-ext.as-class::obj
                            structure-ext.as-class::slot)))
     structure-ext.as-class::obj))
 (defun nil-p (structure-ext.as-class::arg)
   (typep structure-ext.as-class::arg 'nil))
 'nil)
Write a Common Lisp macro to handle this code pattern:
(with-hamt dict (:test test :hash hash :table table) (%hamt-lookup table key (funcall hash key) 0 test))

Problem: Macro call that should be transformed by with-hamt

Macro definition:
(defmacro with-hamt (hamt (&key test hash table) &body body)
  "Accessing HAMT slots"
  `(with-accessors ((,test hamt-test)
                    (,hash hamt-hash)
                    (,table hamt-table))
       ,hamt
     ,@body))

Macroexpansion:
(with-accessors ((test hamt-test) (hash hamt-hash) (table hamt-table)) dict (%hamt-lookup table key (funcall hash key) 0 test))
Write a Common Lisp macro to handle this code pattern:
(match 'some-name)

Problem: Macro call that should be transformed by MATCH

Macro definition:
(defmacro MATCH ...)

Macroexpansion:
(block #:match131
  (let ((#:var130 'some-name))
    (declare (ignorable #:var130))))
Generate a defmacro form that transforms code like this:
(next)

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

Macro definition:
(defmacro next () `(return-from clause nil))

Macroexpansion:
(common-lisp:return-from trivia.level1.impl::clause common-lisp:nil)
Define a macro that eliminates this repetitive pattern:
(make-name-transformer name)

Issue: Macro call that should be transformed by make-name-transformer

Macro definition:
(defmacro make-name-transformer (&rest elements)
  "Return an accessor name transformer.
The unquoted `name' symbol argument is substituted for the slot name.
Class option examples:

  :accessor-name-transformer (make-name-transformer \"FOO-\" name \"-BAR\")

Use the slot name directly:

  :accessor-name-transformer (make-name-transformer name)"
  `(lambda (name definition)
    (declare (ignorable definition))
    (concatenate-symbol ,@(mapcar (lambda (el)
                                    (if (and (symbolp el)
                                             (string= (symbol-name el) "NAME"))
                                        'name
                                        el))
                                  elements))))

Macroexpansion:
(lambda (name definition) (declare (ignorable definition)) (concatenate-symbol name))
Write a Common Lisp macro to handle this code pattern:
(define-path-instruction-pair quadratic-curve-to "Q" (control-x1 control-y1 x y))

Problem: Macro call that should be transformed by define-path-instruction-pair

Macro definition:
(defmacro define-path-instruction-pair (name instruction (&rest args))
  (let ((draw-relative (intern (concatenate 'string (string name) "-R"))))
    `(progn
       (defun ,name (,@args)
         (format-instruction ,instruction ,@args))
       (defun ,draw-relative (,@args)
         (format-instruction ,(string-downcase instruction) ,@args)))))

Macroexpansion:
(progn (defun quadratic-curve-to (control-x1 control-y1 x y) (format-instruction "Q" control-x1 control-y1 x y)) (defun quadratic-curve-to-r (control-x1 control-y1 x y) (format-instruction "q" control-x1 control-y1 x y)))
Write a Common Lisp macro to handle this code pattern:
(some->>
  nil
  (progn))

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

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

Macroexpansion:
(let* ((#:var199 nil)
       (#:var200
        (if #:var199
            (progn #:var199)
            nil)))
  #:var200)
Define a macro that eliminates this repetitive pattern:
(define-simple-documentation-lookup setf-expander cl:setf)

Issue: Macro call that should be transformed by define-simple-documentation-lookup

Macro definition:
(defmacro define-simple-documentation-lookup (class documentation-type)
  `(defmethod documentation ((,class ,class))
     ,(if (eql documentation-type T)
          `(cl:documentation (object ,class) 'T)
          `(cl:documentation (designator ,class) ',documentation-type))))

Macroexpansion:
(defmethod documentation ((setf-expander setf-expander)) (common-lisp:documentation (designator setf-expander) (quote setf)))
Generate a defmacro form that transforms code like this:
(collect-append nil nil)

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

Macro definition:
(defmacro COLLECT-APPEND ...)

Macroexpansion:
(common-lisp:let* ((#:generator-215 (generator nil))
                   #:items-210
                   (#:seq-211 nil))
  (declare (type generator #:generator-215))
  (tagbody
   #:ll-216
    (setq #:items-210 (next-in #:generator-215 (go end)))
    (setq #:seq-211 (cons #:items-210 #:seq-211))
    (go #:ll-216)
   end)
  (apply #'concatenate nil (nreverse #:seq-211)))
Generate a defmacro form that transforms code like this:
(with-preprocessor-state-slots (state) (when if-section-skip-reason (begin-if-section state '(:skipped :ifdef) nil) (return-from process-preprocessing-directive nil)) (let* ((identifier (pop-last-preprocessor-directive-token directive-token-list directive-symbol)) (condition `(:ifdef ,identifier)) (result (preprocessor-macro-exists-p macro-alist identifier))) (begin-if-section state condition result)))

Pattern to recognize: 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 (when if-section-skip-reason (begin-if-section state (quote (:skipped :ifdef)) nil) (return-from process-preprocessing-directive nil)) (let* ((identifier (pop-last-preprocessor-directive-token directive-token-list directive-symbol)) (condition (sb-int:quasiquote (:ifdef #S(sb-impl::comma :expr identifier :kind 0)))) (result (preprocessor-macro-exists-p macro-alist identifier))) (begin-if-section state condition result)))
You are a Common Lisp macro expert. Given this code pattern:
(define-simple-type-map method cl:method)

Write a macro that addresses: 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 ((method method)) (quote common-lisp:method))
Write a Common Lisp macro to handle this code pattern:
(defun-compile-time quotify (thing) (if (self-evaluating? thing) thing `',thing))

Problem: 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 quotify (thing) (if (self-evaluating? thing) thing (sb-int:quasiquote (quote #S(sb-impl::comma :expr thing :kind 0))))) (eval-when (:compile-toplevel) (compile (quote quotify))))
Write a Common Lisp macro to handle this code pattern:
(bind (((:plist a (b _) (c _ 2) (dd d)) '(:b #\b :a #\a :d #\d))) (list a b c dd))

Problem: Macro call that should be transformed by bind

Macro definition:
(defmacro bind ((&rest bindings) &body body)
  "Bind is a replacement for let*, destructuring-bind, multiple-value-bind and more. 

An example is probably the best way to describe its syntax:

    \(bind \(\(a 2\)
           \(\(b &rest args &key \(c 2\) &allow-other-keys\) '\(:a :c 5 :d 10 :e 54\)\)
           \(\(:values d e\) \(truncate 4.5\)\)
           \(\(:structure xxx- slot1 slot2\) \(make-xxx\)\)
           \(\(:flet name \(arg1 arg2\)\) \(+ arg1 arg2\)\)\)
         \(list a b c d e args\)\)

Simple bindings are as in let*. Destructuring is done if the first item
in a binding is a list. Multiple value binding is done if the first item
in a binding is a list and the first item in the list is ':values'. Other
forms have their own syntax. For example, :structure first has the conc
name and then slot names whereas :flet has the function name and a list
of arguments and then the function body (in an implicit progn)."
  (let (declarations)
    (loop while (and (consp (car body)) (eq (caar body) 'declare)) do
          (push (first body) declarations)
          (setf body (rest body)))
    (if bindings
	(let ((*all-declarations* (bind-expand-declarations (nreverse declarations))))
	  (prog1
	      (bind-macro-helper bindings body)
	    (check-for-unused-variable-declarations *all-declarations*)))
        `(locally
             ,@declarations
           ,@body))))

Macroexpansion:
(let* ((#:|values-187| (quote (:b #\LATIN_SMALL_LETTER_B :a #\LATIN_SMALL_LETTER_A :d #\LATIN_SMALL_LETTER_D))) (a (getf #:|values-187| :a)) (b (getf #:|values-187| :b)) (c (getf #:|values-187| :c 2)) (dd (getf #:|values-187| :d))) (declare (ignorable #:|values-187|)) (progn (list a b c dd)))
Define a macro that eliminates this repetitive pattern:
(defstore example (a))

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 example) (quote (a)))))
Define a macro that eliminates this repetitive pattern:
(dynenv-macrolet nil
  :key
  nil)

Issue: Macro call that should be transformed by DYNENV-MACROLET

Macro definition:
(defmacro DYNENV-MACROLET ...)

Macroexpansion:
(macrolet ()
  :key
  nil)
Create a Common Lisp macro for the following transformation. Before code:
(when nil)

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

Macro definition:
(defmacro WHEN ...)

Macroexpansion:
(if nil
    nil)
You are a Common Lisp macro expert. Given this code pattern:
(define-package-syntax
  'some-name)

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

Macro definition:
(defmacro define-package-syntax (&body (package . options))
  (unless (typep package 'package-designator)
    (push package options)
    (setq package *package*))
  `(defsyntax ,(package-syntax-name package)
     ,@options))

Macroexpansion:
(defsyntax syntax
  'some-name)
Generate a defmacro form that transforms code like this:
($+ result)

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

Macro definition:
(defmacro $ (&rest args)
  `(kv ,@args))

Macroexpansion:
(construct-$+- 1 result)
Define a macro that eliminates this repetitive pattern:
(cond->>
  nil
  :key
  nil)

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

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

Macroexpansion:
(let* ((#:var166 nil)
       (#:var167
        (if :key
            (->>
              #:var166)
            #:var166))
       (#:var168
        (if nil
            (->>
              #:var167)
            #:var167)))
  #:var168)
Generate a defmacro form that transforms code like this:
(min-of 'some-name)

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

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

Macroexpansion:
(lc ('some-name) minimize)
Write a Common Lisp macro to handle this code pattern:
(define-error if-test-type-mismatch (:error-type varjo-critical-error) (test-obj) "The result of the test must be a bool.~%~s" (primary-type test-obj))

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 if-test-type-mismatch (:error-type varjo-critical-error :prefix "Varjo") (test-obj) "The result of the test must be a bool.~%~s" (primary-type test-obj))
Generate a defmacro form that transforms code like this:
(sif it it)

Pattern to recognize: 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 it it nil)
Generate a defmacro form that transforms code like this:
(macroexpand-convention (form) (if (consp form) (expand-add-declaration-using-head (first form) decl-specifier 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-add-declaration-using-head (first form) decl-specifier form) form)) (values result (or expanded-p (not (eq result form)))))
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

Macro definition:
(defmacro DEFGENERIC ...)

Macroexpansion:
(progn
 (eval-when (:compile-toplevel)
   (common-lisp:defgeneric nil
       (progn)))
 (eval-when (:load-toplevel :execute)
   (common-lisp:defgeneric nil
       (progn))))