j14i/cl-macros huggingface dataset:
Create a Common Lisp macro for the following transformation. Before code:
(destructuring-bind* nil
    :key
  nil)

What needs to change: Macro call that should be transformed by DESTRUCTURING-BIND*

Macro definition:
(defmacro DESTRUCTURING-BIND* ...)

Macroexpansion:
(let (#:in-body134)
  (flet ((#:handle135 (#:condition136)
           (unless #:in-body134
             (error
              (make-condition 'destructuring-error :lambda-list 'nil
                              :expression ':key :reason #:condition136)))))
    (declare (ignorable (function #:handle135)))
    (let ((#:value137 :key))
      (handler-bind ((error #'#:handle135))
        (destructuring-bind
            ()
            #:value137
          (setf #:in-body134 t)
          (locally nil))))))
You are a Common Lisp macro expert. Given this code pattern:
(any-of nil
  :key
  nil)

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

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

Macroexpansion:
(lc (nil :key nil) thereis)
Define a macro that eliminates this repetitive pattern:
(when-let (previous (find-messenger name :manager manager)) (stop-messenger previous))

Issue: Macro call that should be transformed by when-let

Macro definition:
(defmacro when-let (binding &body body)
  (destructuring-bind (var val) binding
    `(let ((,var ,val))
       (when ,var
	 ,@body))))

Macroexpansion:
(let ((previous (find-messenger name :manager manager))) (when previous (stop-messenger previous)))
Define a macro that eliminates this repetitive pattern:
(with-mocks () (register-mock 'foo/simple) (foo/simple) (pass))

Issue: Macro call that should be transformed by with-mocks

Macro definition:
(defmacro with-mocks ((&key (recordp T)) &body body)
  "Execute BODY in a new mocking context.  Invocations will be recorded
if RECORDP is set (default true)."
  `(call-with-mocks
    (lambda () ,@body)
    :recordp ,recordp))

Macroexpansion:
(call-with-mocks (lambda nil (register-mock (quote foo/simple)) (foo/simple) (pass)) :recordp t)
Write a Common Lisp macro to handle this code pattern:
(macroexpand-convention (form) (if (consp form) (expand-export-class-using-head (first form) form) form))

Problem: 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-export-class-using-head (first form) form) form)) (values result (or expanded-p (not (eq result form)))))
Create a Common Lisp macro for the following transformation. Before code:
(define-alias-binding range ranging)

What needs to change: Macro call that should be transformed by define-alias-binding

Macro definition:
(defmacro define-alias-binding (name referenced-binding-name)
  `(progn (setf (binding ',name) ',referenced-binding-name)
          ',name))

Macroexpansion:
(progn (setf (binding (quote range)) (quote ranging)) (quote range))
Generate a defmacro form that transforms code like this:
(with-changing-vertex (vertex) (call-next-method))

Pattern to recognize: Macro call that should be transformed by with-changing-vertex

Macro definition:
(defmacro with-changing-vertex ((vertex) &body body)
  "This is used to maintain consistency when changing the value of vertex elements while iterating over the vertexes..." 
  (with-variables (v g)
    `(let* ((,v ,vertex)
            (,g (graph ,v)))
       (delete-item-at (graph-vertexes ,g) 
                       (funcall (vertex-key ,g) (element ,v)))  
       ,@body
       (setf (item-at (graph-vertexes ,g) 
                      (funcall (vertex-key ,g) (element ,v))) ,v))))

Macroexpansion:
(let* ((#:v0003 vertex) (#:g0004 (graph #:v0003))) (delete-item-at (graph-vertexes #:g0004) (funcall (vertex-key #:g0004) (element #:v0003))) (call-next-method) (setf (item-at (graph-vertexes #:g0004) (funcall (vertex-key #:g0004) (element #:v0003))) #:v0003))
Define a macro that eliminates this repetitive pattern:
(match 'some-name)

Issue: Macro call that should be transformed by MATCH

Macro definition:
(defmacro MATCH ...)

Macroexpansion:
(match* ('some-name))
You are a Common Lisp macro expert. Given this code pattern:
(defjs map4() (emit this.name 1) (emit "hello" this.k))

Write a macro that addresses: 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 nil (emit this.name 1) (emit "hello" this.k))))) (setf (gethash (quote map4) *js-definitions*) js-body) (defun map4 nil (get-element "retval" (car (docs (db.eval js-body))))))
Generate a defmacro form that transforms code like this:
(c?-with-stored (v :foo store 'nothing) (bwhen (val (value v)) val))

Pattern to recognize: Macro call that should be transformed by c?-with-stored

Macro definition:
(defmacro c?-with-stored ((var key store &optional default) &body body)
  `(c? (bwhen-c-stored (,var ,key ,store ,default)
	 ,@body)))

Macroexpansion:
(c? (bwhen-c-stored (v :foo store (quote nothing)) (bwhen (val (value v)) val)))
Generate a defmacro form that transforms code like this:
(ematch0 list ((cons it nil) (cons (funcall fn it t) nil)) ((cons it rest) (cons (funcall fn it nil) (mapcar1-with-last fn rest))))

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

Macro definition:
(defmacro ematch0 (what &body clauses)
  `(match0 ,what
     ,@clauses
     (_ (error "level0 match error!"))))

Macroexpansion:
(match0 list ((cons it nil) (cons (funcall fn it t) nil)) ((cons it rest) (cons (funcall fn it nil) (mapcar1-with-last fn rest))) (_ (error "level0 match error!")))
Define a macro that eliminates this repetitive pattern:
(skip () :report (lambda (s) (format s "Skip the test ~S and all its dependencies." (name test))) (with-run-state (result-list) (push (make-instance 'test-skipped :reason "Circular dependencies" :test-case test) result-list)) (setf (status test) :circular))

Issue: Macro call that should be transformed by skip

Macro definition:
(defmacro skip (&rest reason)
  "Generates a TEST-SKIPPED result."
  `(add-result 'test-skipped :reason (format nil ,@reason)))

Macroexpansion:
(add-result (quote test-skipped) :reason (format nil nil :report (lambda (s) (format s "Skip the test ~S and all its dependencies." (name test))) (with-run-state (result-list) (push (make-instance (quote test-skipped) :reason "Circular dependencies" :test-case test) result-list)) (setf (status test) :circular)))
You are a Common Lisp macro expert. Given this code pattern:
(define-custom-var (:beginning-of-array *beginning-of-array-handler*))

Write a macro that addresses: 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 (*beginning-of-array-handler* . :beginning-of-array)) *custom-vars* :test (function equal)) (defvar *beginning-of-array-handler*)))
Define a macro that eliminates this repetitive pattern:
(define-error args-incompatible () (previous-args current-args) "Sorry but the output arguments from one stage are not compatible with the input arguments of the next.~%Out vars from previous stage: ~a~%In args from this stage: ~a" previous-args current-args)

Issue: 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 args-incompatible (:error-type varjo-error :prefix "Varjo") (previous-args current-args) "Sorry but the output arguments from one stage are not compatible with the input arguments of the next.~%Out vars from previous stage: ~a~%In args from this stage: ~a" previous-args current-args)
Create a Common Lisp macro for the following transformation. Before code:
(define-mustache-character #\! (make-instance 'comment-tag :text ""))

What needs to change: 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 #\EXCLAMATION_MARK (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 comment-tag) :text "")))
Create a Common Lisp macro for the following transformation. Before code:
(when (node-slot type) (make-proxy type type))

What needs to change: 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 type) (make-proxy type type))
Define a macro that eliminates this repetitive pattern:
(macroexpand-convention (form) (if (consp form) (expand-export-accessors-using-head (first form) form) form))

Issue: 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-export-accessors-using-head (first form) form) form)) (values result (or expanded-p (not (eq result form)))))
Define a macro that eliminates this repetitive pattern:
(define-simple-definition-resolver special-variable (designator) (eq :special (sb-cltl2:variable-information designator)))

Issue: Macro call that should be transformed by define-simple-definition-resolver

Macro definition:
(defmacro define-simple-definition-resolver (class lookup-function &body body)
  (let ((package (gensym "PACKAGE")))
    `(define-definition-resolver ,class (,class ,package)
       (when (ignore-errors ,(if body
                                 `(let ((,(first lookup-function) ,class))
                                    ,@body)
                                 `(,lookup-function ,class)))
         (list (make-instance ',class :designator ,class :package ,package))))))

Macroexpansion:
(define-definition-resolver special-variable (special-variable #:package145) (when (ignore-errors (let ((designator special-variable)) (eq :special (sb-cltl2:variable-information designator)))) (list (make-instance (quote special-variable) :designator special-variable :package #:package145))))
Generate a defmacro form that transforms code like this:
($slot nil)

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

Macro definition:
(defmacro $SLOT ...)

Macroexpansion:
(get-slot nil)
Write a Common Lisp macro to handle this code pattern:
(some-> 'some-name)

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

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

Macroexpansion:
(let* ((#:g145 'some-name))
  #:g145)
You are a Common Lisp macro expert. Given this code pattern:
(setypecase 'foo (string :nono))

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

Macro definition:
(defmacro setypecase (keyform &body cases)
  "Like ETYPECASE, except binds the keyform to IT (via SYMBOL-MACROLET) for
the scope of the cases. IT can be set with SETF."
  `(symbolic etypecase ,keyform ,@cases))

Macroexpansion:
(symbolic etypecase (quote foo) (string :nono))
You are a Common Lisp macro expert. Given this code pattern:
(make-window-or-instance nil nil)

Write a macro that addresses: Macro call that should be transformed by MAKE-WINDOW-OR-INSTANCE

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

Macroexpansion:
(make-$instance nil nil)
Define a macro that eliminates this repetitive pattern:
(cond-<>>
  nil
  nil)

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

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

Macroexpansion:
(let* ((#:var155 nil)
       (#:var156
        (if nil
            (-<>>
              #:var155)
            #:var155)))
  #:var156)
Write a Common Lisp macro to handle this code pattern:
(inext-or-error nil (progn))

Problem: Macro call that should be transformed by INEXT-OR-ERROR

Macro definition:
(defmacro INEXT-OR-ERROR ...)

Macroexpansion:
(let ((vals (multiple-value-list (funcall (i-coro nil) (progn)))))
  (if (not vals)
      (error 'stop-iteration)
      (values (car vals) t)))
Generate a defmacro form that transforms code like this:
(def-neo4j-fun get-node-property (node-id property) :get (:uri-spec (format nil "node/~A/properties/~A" node-id (if (symbolp property) (string-downcase (symbol-name property)) property))) (:status-handlers (200 (decode-neo4j-json-output body)) (400 (error 'invalid-data-sent-error :uri uri :json json)) (404 (error 'property-not-found-error :uri uri))))

Pattern to recognize: Macro call that should be transformed by def-neo4j-fun

Macro definition:
(defmacro def-neo4j-fun (name lambda-list method &rest args)
  `(progn
     (defun ,name (&key ,@lambda-list)
       (let ((uri ,(cadr (assoc :uri-spec args)))
             (json (encode-neo4j-json-payload ,@(aif (assoc :encode args)
                                                     (cdr it)
                                                     (list '() :string)))))
         (make-neo4j-request ,method uri json
                             (list ,@(mapcar (lambda (handler)
                                               `(list ,(car handler) (lambda (body uri json)
                                                                  ,(cadr handler))))
                                             (cdr (assoc :status-handlers args)))))))))

Macroexpansion:
(progn (defun get-node-property (&key node-id property) (let ((uri (format nil "node/~A/properties/~A" node-id (if (symbolp property) (string-downcase (symbol-name property)) property))) (json (encode-neo4j-json-payload nil :string))) (make-neo4j-request :get uri json (list (list 200 (lambda (body uri json) (decode-neo4j-json-output body))) (list 400 (lambda (body uri json) (error (quote invalid-data-sent-error) :uri uri :json json))) (list 404 (lambda (body uri json) (error (quote property-not-found-error) :uri uri))))))))
Define a macro that eliminates this repetitive pattern:
(with-table-name table-name-b (yield clause-b))

Issue: Macro call that should be transformed by with-table-name

Macro definition:
(defmacro with-table-name (table-name &body body)
  `(let ((*table-name-scope* ,table-name))
     ,@body))

Macroexpansion:
(let ((*table-name-scope* table-name-b)) (yield clause-b))
Create a Common Lisp macro for the following transformation. Before code:
(vect-of nil (progn))

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

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

Macroexpansion:
(let ((#:vect139 (make-array 10 :adjustable t :fill-pointer 0)))
  (do-for ((progn))
    (vector-push-extend nil #:vect139))
  #:vect139)
Write a Common Lisp macro to handle this code pattern:
(psetq nil nil)

Problem: Macro call that should be transformed by PSETQ

Macro definition:
(defmacro PSETQ ...)

Macroexpansion:
(progn (setq nil nil) nil)
Write a Common Lisp macro to handle this code pattern:
(defhandler setq (setq &rest pairs) (declare (ignore setq)) (let ((vars (loop for s in pairs by #'cddr collect (macroexpand s *env*)))) (let ((expanded (loop for n in vars for r in (rest pairs) by #'cddr collect n collect r))) (if (some 'listp vars) (e `(setf ,@expanded)) `(list 'setq ,@(e-list expanded))))))

Problem: Macro call that should be transformed by defhandler

Macro definition:
(defmacro defhandler (symbol lambda-list &body body)
  (let ((syms (force-list symbol)))
    (let ((func (intern (format nil "~A~A" 'hander- (first syms)))))
      `(progn
         (defun ,func ,lambda-list
           ,@body)
         (setf
          ,@(loop for sym in syms
               collect `(gethash ',sym *form-handler*)
               collect `',func))))))

Macroexpansion:
(progn (defun hander-setq (setq &rest pairs) (declare (ignore setq)) (let ((vars (loop for s in pairs by (function cddr) collect (macroexpand s *env*)))) (let ((expanded (loop for n in vars for r in (rest pairs) by (function cddr) collect n collect r))) (if (some (quote listp) vars) (e (sb-int:quasiquote (setf #S(sb-impl::comma :expr expanded :kind 2)))) (sb-int:quasiquote (list (quote setq) #S(sb-impl::comma :expr (e-list expanded) :kind 2))))))) (setf (gethash (quote setq) *form-handler*) (quote hander-setq)))
You are a Common Lisp macro expert. Given this code pattern:
(with-preprocessor-state-slots (state) (when if-section-skip-reason (return-from process-preprocessing-directive nil)) (let ((identifier (pop-last-preprocessor-directive-token directive-token-list directive-symbol))) (remove-local-preprocessor-macro state identifier)))

Write a macro that addresses: 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 (return-from process-preprocessing-directive nil)) (let ((identifier (pop-last-preprocessor-directive-token directive-token-list directive-symbol))) (remove-local-preprocessor-macro state identifier)))
Generate a defmacro form that transforms code like this:
(enable-quasi-quoted-bivalent-to-bivalent-emitting-form-syntax nil)

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

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

Macroexpansion:
(eval-when (:compile-toplevel :execute)
  (setf *readtable* (copy-readtable *readtable*))
  (set-quasi-quoted-bivalent-to-bivalent-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
                                                                           "biv")
  (values))
Write a Common Lisp macro to handle this code pattern:
(draw scene (:rect :x 40 :y 40 :height 30 :width 30) :stroke "blue" :stroke-width 1 :fill "yellow")

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 ((#:g143 (funcall (function make-svg-element) :rect (append (list :x 40 :y 40 :height 30 :width 30) (list :stroke "blue" :stroke-width 1 :fill "yellow"))))) (add-element scene #:g143) #:g143)
Define a macro that eliminates this repetitive pattern:
(define-error for-loop-only-one-var () () "for loops can only iterate over one variable")

Issue: 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 for-loop-only-one-var (:error-type varjo-error :prefix "Varjo") nil "for loops can only iterate over one variable")
Define a macro that eliminates this repetitive pattern:
(with-special-initargs nil)

Issue: Macro call that should be transformed by WITH-SPECIAL-INITARGS

Macro definition:
(defmacro WITH-SPECIAL-INITARGS ...)

Macroexpansion:
(funcall-with-special-initargs (list) (lambda ()))