j14i/cl-macros huggingface dataset:
Define a macro that eliminates this repetitive pattern:
(alter nil nil)

Issue: Macro call that should be transformed by ALTER

Macro definition:
(defmacro ALTER ...)

Macroexpansion:
(compiler-let ((*optimize-series-expressions* nil)) (alter nil nil))
Generate a defmacro form that transforms code like this:
($> "l" -9)

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

Macro definition:
(defmacro $> (&rest args)
  `($op "$gt" ,@args))

Macroexpansion:
($op "$gt" "l" -9)
Create a Common Lisp macro for the following transformation. Before code:
(make-name-transformer)

What needs to change: Macro call that should be transformed by MAKE-NAME-TRANSFORMER

Macro definition:
(defmacro MAKE-NAME-TRANSFORMER ...)

Macroexpansion:
(lambda (name definition) (declare (ignorable definition)) (concatenate-symbol))
Write a Common Lisp macro to handle this code pattern:
(pop-preprocessor-directive-token token-list "")

Problem: Macro call that should be transformed by pop-preprocessor-directive-token

Macro definition:
(defmacro pop-preprocessor-directive-token (token-list directive-name &key (errorp t))
  "Pops the next token in TOKEN-LIST ignoring `+whitespace-marker+'"
  (with-gensyms (head_)
    `(let ((,head_
             (check-and-pop-pp-directive-token-1 ,token-list ,directive-name ,errorp)))
       (if (eq +whitespace-marker+ ,head_)
           (check-and-pop-pp-directive-token-1 ,token-list ,directive-name ,errorp)
           ,head_))))

Macroexpansion:
(let ((#:head_267 (check-and-pop-pp-directive-token-1 token-list "" t))) (if (eq +whitespace-marker+ #:head_267) (check-and-pop-pp-directive-token-1 token-list "" t) #:head_267))
Generate a defmacro form that transforms code like this:
(action (:after node-variable node) (when (eq name (node-variable-value node)) (incf count)) (values))

Pattern to recognize: 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-variable) (lambda (node) (declare (type node-variable node)) (when (eq name (node-variable-value node)) (incf count)) (values)))
Create a Common Lisp macro for the following transformation. Before code:
(defjs reduce6(k vals) (let ((sum 0) (index 0)) (dolist (c vals) (if (= index 3) (return c) (progn (incf index 1) (incf sum c)))) (return sum)))

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

Macro definition:
(defmacro defjs (name args &body body)
  "Define client side javascript. Works like defun; body is in lisp, with parenscript
   additions, like return. So (defjs hello (x y) (return (+ x y))) defines an adder. 
   macro creates a lisp function which sends the javascript function over to the mongo 
   server to be evaluated. Result is processed and returned to the reader. 
   This will execute 10 times on the server :
   (mapcar (lambda (x) (hello 10 x)) (list 1 2 3 4 5 6 7 8 9 10))"
  `(let* ((js-body (parenscript:ps (lambda ,args ,@body))))
     (setf (gethash ',name *js-definitions*) js-body)
     (defun ,name ,args
       (get-element "retval" (car (docs (db.eval js-body ,@args)))))))

Macroexpansion:
(let* ((js-body (parenscript:ps (lambda (k vals) (let ((sum 0) (index 0)) (dolist (c vals) (if (= index 3) (return c) (progn (incf index 1) (incf sum c)))) (return sum)))))) (setf (gethash (quote reduce6) *js-definitions*) js-body) (defun reduce6 (k vals) (get-element "retval" (car (docs (db.eval js-body k vals))))))
Generate a defmacro form that transforms code like this:
(enable-sharp-comment-syntax)

Pattern to recognize: Macro call that should be transformed by ENABLE-SHARP-COMMENT-SYNTAX

Macro definition:
(defmacro ENABLE-SHARP-COMMENT-SYNTAX ...)

Macroexpansion:
(eval-when (:compile-toplevel :execute)
  (setf *readtable* (copy-readtable *readtable*))
  (set-sharp-comment-syntax-in-readtable)
  (values))
Create a Common Lisp macro for the following transformation. Before code:
(decf 'some-name)

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

Macro definition:
(defmacro DECF ...)

Macroexpansion:
(let* ((#:some-name177 some-name)
       (#:new176 (sb-impl::xsubtract 1 '#:some-name177)))
  (funcall #'(setf quote) #:new176 #:some-name177))
Write a Common Lisp macro to handle this code pattern:
(defun* nil
    (progn))

Problem: Macro call that should be transformed by DEFUN*

Macro definition:
(defmacro DEFUN* ...)

Macroexpansion:
(progn (declaim (ftype (function (t) t) nil)) (defun (progn) (the t ())))
Generate a defmacro form that transforms code like this:
(defsynonym :counting :count)

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 :counting) (quote synonym)) (quote :count)))
Generate a defmacro form that transforms code like this:
(dynamic-relet* nil
  (progn))

Pattern to recognize: Macro call that should be transformed by DYNAMIC-RELET*

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

Macroexpansion:
(progn (progn))
Define a macro that eliminates this repetitive pattern:
(collect-last nil nil)

Issue: Macro call that should be transformed by COLLECT-LAST

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

Macroexpansion:
(common-lisp:let* ((#:generator-517 (generator nil))
                   #:items-511
                   (#:item-513 nil))
  (declare (type generator #:generator-517)
           (type (null-or t) #:item-513))
  (tagbody
   #:ll-518
    (setq #:items-511 (next-in #:generator-517 (go end)))
    (setq #:item-513 #:items-511)
    (go #:ll-518)
   end)
  #:item-513)
Write a Common Lisp macro to handle this code pattern:
(with-assert-observers ("changing bar to 2" bar bar-1) (setf (value (store-lookup :bar store)) 2))

Problem: Macro call that should be transformed by with-assert-observers

Macro definition:
(defmacro with-assert-observers ((desc &rest asserted-observers) &body body)  
  `(let ((*observers* nil))
     (trc ,desc " -- checking observers")
     ,@body
     (let ((superfluous-observers (loop for run in *observers* if (not (member run (list ,@asserted-observers))) collect run))
	   (failed-observers (loop for asserted in (list ,@asserted-observers) if (not (member asserted *observers*)) collect asserted)))
       (trc "called observers on" *observers* :superflous superfluous-observers :failed failed-observers)
       (assert (not superfluous-observers))
       (assert (not failed-observers)))))

Macroexpansion:
(let ((*observers* nil)) (trc "changing bar to 2" " -- checking observers") (setf (value (store-lookup :bar store)) 2) (let ((superfluous-observers (loop for run in *observers* if (not (member run (list bar bar-1))) collect run)) (failed-observers (loop for asserted in (list bar bar-1) if (not (member asserted *observers*)) collect asserted))) (trc "called observers on" *observers* :superflous superfluous-observers :failed failed-observers) (assert (not superfluous-observers)) (assert (not failed-observers))))
Write a Common Lisp macro to handle this code pattern:
(define-condition/a dbi-internal-error (dbi-database-error) () (:documentation "Exception raised when the database encounters an internal error, e.g. the cursor is not valid anymore, the transaction is out of sync."))

Problem: Macro call that should be transformed by define-condition/a

Macro definition:
(defmacro define-condition/a (name parent-types slots &body options)
  `(progn
     (define-condition ,name ,parent-types ,slots ,@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 (define-condition dbi-internal-error (dbi-database-error) nil (:documentation "Exception raised when the database encounters an internal error, e.g. the cursor is not valid anymore, the transaction is out of sync.")) (deftype <dbi-internal-error> nil (quote dbi-internal-error)) (setf (find-class (quote <dbi-internal-error>)) (find-class (quote dbi-internal-error))))
Create a Common Lisp macro for the following transformation. Before code:
(with-decoder-simple-list-semantics (let ((*json-symbols-package* (find-package :keyword)) (*json-identifier-name-to-lisp* #'simplified-camel-case-to-lisp)) (is (equalp '((:hello-key . "hej") (:hi-starts-with-upper-case . "tjena") (:jsonall-capitals . "totae majusculae") (:two_words . "duo verba") (:camel-case_mixed_4_parts . "partes miscella quatuor")) (decode-json-from-string " { \"helloKey\" : \"hej\" , \"HiStartsWithUpperCase\" : \"tjena\", \"JSONAllCapitals\": \"totae majusculae\", \"TWO_WORDS\": \"duo verba\", \"camelCase_Mixed_4_PARTS\": \"partes miscella quatuor\" }")))))

What needs to change: Macro call that should be transformed by with-decoder-simple-list-semantics

Macro definition:
(defmacro with-decoder-simple-list-semantics (&body body)
  "Execute BODY in a dynamic environement where the decoder semantics
is such as set by SET-DECODER-SIMPLE-LIST-SEMANTICS."
  `(with-shadowed-custom-vars
     (set-decoder-simple-list-semantics)
     ,@body))

Macroexpansion:
(with-shadowed-custom-vars (set-decoder-simple-list-semantics) (let ((*json-symbols-package* (find-package :keyword)) (*json-identifier-name-to-lisp* (function simplified-camel-case-to-lisp))) (is (equalp (quote ((:hello-key . "hej") (:hi-starts-with-upper-case . "tjena") (:jsonall-capitals . "totae majusculae") (:two_words . "duo verba") (:camel-case_mixed_4_parts . "partes miscella quatuor"))) (decode-json-from-string " { \"helloKey\" : \"hej\" , \"HiStartsWithUpperCase\" : \"tjena\", \"JSONAllCapitals\": \"totae majusculae\", \"TWO_WORDS\": \"duo verba\", \"camelCase_Mixed_4_PARTS\": \"partes miscella quatuor\" }")))))
Define a macro that eliminates this repetitive pattern:
(check-cursor-attached cluffer:delete-item (cursor))

Issue: Macro call that should be transformed by check-cursor-attached

Macro definition:
(defmacro check-cursor-attached (name arguments)
  (let ((args (substitute '(cursor cluffer:cursor) 'cursor arguments)))
    `(defmethod ,name :before ,args
       (declare (ignore ,@(set-difference (remove 'cursor arguments)
                                          lambda-list-keywords)))
       (unless (cluffer:cursor-attached-p cursor)
         (error 'cluffer:cursor-detached)))))

Macroexpansion:
(defmethod cluffer:delete-item :before ((cursor cluffer:cursor)) (declare (ignore)) (unless (cluffer:cursor-attached-p cursor) (error (quote cluffer:cursor-detached))))
Create a Common Lisp macro for the following transformation. Before code:
(with-standard-readtable
  nil)

What needs to change: Macro call that should be transformed by WITH-STANDARD-READTABLE

Macro definition:
(defmacro WITH-STANDARD-READTABLE ...)

Macroexpansion:
(bind ((*readtable* (with-standard-io-syntax (copy-readtable *readtable*))))
  nil)
Create a Common Lisp macro for the following transformation. Before code:
(decf nil (progn))

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

Macro definition:
(defmacro DECF ...)

Macroexpansion:
(setq nil (sb-impl::xsubtract (progn) nil))
Write a Common Lisp macro to handle this code pattern:
(draw scene (:circle :cx (random 500) :cy (random 500) :r (+ 10 (random 45))) :stroke "rgb(232, 229, 148)" :fill (one-of *groovy-test-colors*))

Problem: Macro call that should be transformed by draw

Macro definition:
(defmacro draw (scene (shape &rest params) &rest opts)
  (let ((element (gensym)))
    `(let ((,element (funcall #'make-svg-element ,shape (append (list ,@params) (list ,@opts)))))
       (add-element ,scene ,element)
       ,element)))

Macroexpansion:
(let ((#:g145 (funcall (function make-svg-element) :circle (append (list :cx (random 500) :cy (random 500) :r (+ 10 (random 45))) (list :stroke "rgb(232, 229, 148)" :fill (one-of *groovy-test-colors*)))))) (add-element scene #:g145) #:g145)
Define a macro that eliminates this repetitive pattern:
(define-cruft dispatch-macro-char-p (char rt) "Is CHAR a dispatch macro character in RT?" #+ :common-lisp (handler-case (locally #+clisp (declare (notinline get-dispatch-macro-character)) (get-dispatch-macro-character char #\x rt) t) (error () nil)))

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

Macro definition:
(defmacro define-cruft (name lambda-list &body (docstring . alternatives))
  (assert (typep docstring 'string) (docstring) "Docstring missing!")
  (assert (not (null alternatives)))
  `(progn
     (declaim (inline ,name))
     (defun ,name ,lambda-list ,docstring ,(first alternatives))))

Macroexpansion:
(progn (declaim (inline dispatch-macro-char-p)) (defun dispatch-macro-char-p (char rt) "Is CHAR a dispatch macro character in RT?" (handler-case (locally (get-dispatch-macro-character char #\LATIN_SMALL_LETTER_X rt) t) (error nil nil))))
Create a Common Lisp macro for the following transformation. Before code:
(define-simple-documentation-lookup structure cl:structure)

What needs to change: 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 ((structure structure)) (common-lisp:documentation (designator structure) (quote common-lisp:structure)))
Generate a defmacro form that transforms code like this:
(collect-length 'some-name)

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

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

Macroexpansion:
(common-lisp:let* ((#:generator-468 (generator 'some-name)) (#:number-465 0))
  (declare (type generator #:generator-468)
           (type fixnum #:number-465))
  (tagbody
   #:ll-469
    (next-in #:generator-468 (go end))
    (incf #:number-465)
    (go #:ll-469)
   end)
  #:number-465)
You are a Common Lisp macro expert. Given this code pattern:
(with-symbol-access)

Write a macro that addresses: Macro call that should be transformed by WITH-SYMBOL-ACCESS

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

Macroexpansion:
(let ((*symbol-access* t)))
Define a macro that eliminates this repetitive pattern:
(make-window-or-instance 'some-name)

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

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

Macroexpansion:
(make-$instance 'some-name)
Create a Common Lisp macro for the following transformation. Before code:
(dreletf nil)

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

Macro definition:
(defmacro DRELETF ...)

Macroexpansion:
(let ((#:symbol-store231
       (with-symbol-access
         (list))))
  (special-symbol-reprogv #:symbol-store231
      (list)
    (locally (declare (special)))))
Create a Common Lisp macro for the following transformation. Before code:
(do-readtable (char readtable readtable) (set-syntax-from-char char #\A readtable))

What needs to change: Macro call that should be transformed by do-readtable

Macro definition:
(defmacro do-readtable ((entry-designator readtable &optional result)
                        &body body)
  "Iterate through a readtable's macro characters, and dispatch macro characters."
  (destructuring-bind (char &optional reader-fn non-terminating-p disp? table)
      (if (symbolp entry-designator)
          (list entry-designator)
          entry-designator)
    (let ((iter (gensym "ITER+"))
          (more? (gensym "MORE?+"))
          (rt (gensym "READTABLE+")))
      `(let ((,rt ,readtable))
         (with-readtable-iterator (,iter ,rt)
           (loop
             (multiple-value-bind (,more?
                                   ,char
                                   ,@(when reader-fn (list reader-fn))
                                   ,@(when disp? (list disp?))
                                   ,@(when table (list table)))
                 (,iter)
               (unless ,more? (return ,result))
               (let ,(when non-terminating-p
                       ;; FIXME: N-T-P should be incorporated in iterators.
                       `((,non-terminating-p
                          (nth-value 1 (get-macro-character ,char ,rt)))))
                 ,@body))))))))

Macroexpansion:
(let ((#:readtable+146 readtable)) (with-readtable-iterator (#:iter+144 #:readtable+146) (loop (multiple-value-bind (#:more?+145 char) (#:iter+144) (unless #:more?+145 (return readtable)) (let nil (set-syntax-from-char char #\LATIN_CAPITAL_LETTER_A readtable))))))
Write a Common Lisp macro to handle this code pattern:
(defobject nil (progn))

Problem: Macro call that should be transformed by DEFOBJECT

Macro definition:
(defmacro DEFOBJECT ...)

Macroexpansion:
(object :parents (list) :properties (list (list 'progn nil)))
Write a Common Lisp macro to handle this code pattern:
(dynenv-function nil)

Problem: Macro call that should be transformed by DYNENV-FUNCTION

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

Macroexpansion:
(dynenv-function% 'nil)
Create a Common Lisp macro for the following transformation. Before code:
(define-path-instruction-pair line-to "L" (x y))

What needs to change: 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 line-to (x y) (format-instruction "L" x y)) (defun line-to-r (x y) (format-instruction "l" x y)))
Generate a defmacro form that transforms code like this:
(with-unique-js-names nil)

Pattern to recognize: Macro call that should be transformed by WITH-UNIQUE-JS-NAMES

Macro definition:
(defmacro WITH-UNIQUE-JS-NAMES ...)

Macroexpansion:
(with-ps-gensyms nil)
Create a Common Lisp macro for the following transformation. Before code:
(is-true t)

What needs to change: Macro call that should be transformed by is-true

Macro definition:
(defmacro is-true (condition &rest reason-args)
  "Like IS this check generates a pass if CONDITION returns true
  and a failure if CONDITION returns false. Unlike IS this check
  does not inspect CONDITION to determine how to report the
  failure."
  `(if ,condition
       (add-result 'test-passed :test-expr ',condition)
       (process-failure ',condition
                        ,@(or reason-args
                              `("~S did not return a true value" ',condition)))))

Macroexpansion:
(if t (add-result (quote test-passed) :test-expr (quote t)) (process-failure (quote t) "~S did not return a true value" (quote t)))
Generate a defmacro form that transforms code like this:
(or nil)

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

Macro definition:
(defmacro OR ...)

Macroexpansion:
(the t nil)
Define a macro that eliminates this repetitive pattern:
(when (node-slot identifier) (del-proxy identifier))

Issue: 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 (node-slot identifier) (del-proxy identifier))
Define a macro that eliminates this repetitive pattern:
(define-let+-expansion 'some-name)

Issue: Macro call that should be transformed by DEFINE-LET+-EXPANSION

Macro definition:
(defmacro DEFINE-LET+-EXPANSION ...)

Macroexpansion:
(progn
 (defmacro quote (&whole #:whole126 &rest some-name)
   #A((16) base-char . "LET+ form QUOTE.")
   (declare (ignore some-name))
   #:whole126)
 (defmethod let+-expansion-for-list
            ((first (eql 'quote)) #:arguments125 value body)
   (assert value nil "Missing value form in ~A." 'quote)
   (let ((#:value-once-var127 (gensym "VALUE")))
     `(let ((,#:value-once-var127 ,value))
        (declare (ignorable ,#:value-once-var127))
        ,(let ((value #:value-once-var127))
           (destructuring-bind (&rest some-name) #:arguments125))))))
Write a Common Lisp macro to handle this code pattern:
(lret* ((type `(integer 0 (,end))) (vector (make-array end :element-type type :initial-element 0))) (nlet lp ((i 0)) (declare (type array-index i)) (if (= i end) vector (progn (setf (aref vector i) i) (lp (1+ i))))))

Problem: Macro call that should be transformed by lret*

Macro definition:
(defmacro lret* ((&rest bindings) &body body)
  "Cf. `lret'."
  `(lret-aux let* ,bindings
     ,@body))

Macroexpansion:
(lret-aux let* ((type (sb-int:quasiquote (integer 0 (#S(sb-impl::comma :expr end :kind 0))))) (vector (make-array end :element-type type :initial-element 0))) (nlet lp ((i 0)) (declare (type array-index i)) (if (= i end) vector (progn (setf (aref vector i) i) (lp (1+ i))))))
Create a Common Lisp macro for the following transformation. Before code:
(define-custom-var (:end-of-object *end-of-object-handler*))

What needs to change: Macro call that should be transformed by define-custom-var

Macro definition:
(defmacro define-custom-var ((key name) &rest other-args)
  `(eval-when (:compile-toplevel :load-toplevel :execute)
     (progn (pushnew '(,name . ,key) *custom-vars* :test #'equal)
            (defvar ,name ,@other-args))))

Macroexpansion:
(eval-when (:compile-toplevel :load-toplevel :execute) (progn (pushnew (quote (*end-of-object-handler* . :end-of-object)) *custom-vars* :test (function equal)) (defvar *end-of-object-handler*)))
Define a macro that eliminates this repetitive pattern:
(acond ((null 1) (list :no it)) ((+ 1 2) (list :yes it)) (t :nono))

Issue: Macro call that should be transformed by acond

Macro definition:
(defmacro acond (&body clauses)
  "Like COND, except result of each test-form is bound to IT (via LET) for the
scope of the corresponding clause."
  (labels ((rec (clauses)
	     (if clauses
		 (destructuring-bind ((test &body body) . rest)  clauses
		   (if body
		       `(anaphoric if ,test (progn ,@body) ,(rec rest))
		       `(anaphoric if ,test it ,(rec rest))))
		 nil)))
    (rec clauses)))

Macroexpansion:
(let ((#:it (null 1))) (if #:it (let ((it #:it)) (declare (ignorable it)) (list :no it)) (acond ((+ 1 2) (list :yes it)) (t :nono))))
Generate a defmacro form that transforms code like this:
(do-iterator 'some-name)

Pattern to recognize: Macro call that should be transformed by DO-ITERATOR

Macro definition:
(defmacro DO-ITERATOR ...)

Macroexpansion:
(block nil
  (let ((#:g407 (iterator some-name)))
    (unwind-protect
        (loop named #:g410
              for (#:g408 #:g409) = (multiple-value-list
                                     (iterator-next! #:g407))
              while #:g409
              for quote = #:g408
              do (progn))
      (iterator-finish! #:g407))))
You are a Common Lisp macro expert. Given this code pattern:
(as-> nil
    nil)

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

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

Macroexpansion:
nil