j14i/cl-macros huggingface dataset:
Write a Common Lisp macro to handle this code pattern:
(old `(let ((,fdefn (eval (intern "BASIC-DEFINITION" "SB-INT"))) (,arglist (eval (intern "ARG-LIST" "SB-INT")))) ,@body))

Problem: Macro call that should be transformed by old

Macro definition:
(defmacro old (expression)
  "Only available in postconditions, OLD evaluates its expression before the
   primary method is executed and stores it for use in the postcondition."
  (let ((value (gensym)))
    `(if *preparing-postconditions*
         (let ((,value ,expression))
           (push ,value *postcondition-values*)
           ,value)
         (pop *postcondition-values*))))

Macroexpansion:
(if *preparing-postconditions* (let ((#:g163 (sb-int:quasiquote (let ((#S(sb-impl::comma :expr fdefn :kind 0) (eval (intern "BASIC-DEFINITION" "SB-INT"))) (#S(sb-impl::comma :expr arglist :kind 0) (eval (intern "ARG-LIST" "SB-INT")))) #S(sb-impl::comma :expr body :kind 2))))) (push #:g163 *postcondition-values*) #:g163) (pop *postcondition-values*))
Create a Common Lisp macro for the following transformation. Before code:
(define-global-parameter* nil :key nil)

What needs to change: Macro call that should be transformed by DEFINE-GLOBAL-PARAMETER*

Macro definition:
(defmacro DEFINE-GLOBAL-PARAMETER* ...)

Macroexpansion:
(progn
 (setf (get 'nil +value-key+) :key)
 (sb-ext:define-load-time-global nil (get 'nil +value-key+))
 (setf nil (get 'nil +value-key+))
 (remprop 'nil +value-key+)
 'nil)
You are a Common Lisp macro expert. Given this code pattern:
(js-inline nil)

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

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

Macroexpansion:
(js-inline* '(progn nil))
Define a macro that eliminates this repetitive pattern:
(pop-preprocessor-directive-token directive-token-list directive-symbol)

Issue: 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_265 (check-and-pop-pp-directive-token-1 directive-token-list directive-symbol t))) (if (eq +whitespace-marker+ #:head_265) (check-and-pop-pp-directive-token-1 directive-token-list directive-symbol t) #:head_265))
Write a Common Lisp macro to handle this code pattern:
(match0 seq1 ((list* (list* v1 o1) rest) (match0 (find v1 seq2 :key #'car) ((list* _ o2) (cons (list v1 :type `(or ,(getf o1 :type) ,(getf o2 :type)) :place (or (getf o1 :place) (getf o2 :place)) :ignorable (or (getf o1 :ignorable) (getf o2 :ignorable))) (merge-variables rest seq2))))))

Problem: 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*141 seq1)) (declare (ignorable #:*what*141)) (if (and (consp #:*what*141) (let ((#:*what*142 (car #:*what*141))) (declare (ignorable #:*what*142)) (and (consp #:*what*142) (let ((#:*what*143 (car #:*what*142))) (declare (ignorable #:*what*143)) t) (let ((#:*what*144 (cdr #:*what*142))) (declare (ignorable #:*what*144)) t))) (let ((#:*what*145 (cdr #:*what*141))) (declare (ignorable #:*what*145)) t)) (let* ((#:*what*142 (car #:*what*141)) (#:*what*143 (car #:*what*142)) (v1 #:*what*143) (#:*what*144 (cdr #:*what*142)) (o1 #:*what*144) (#:*what*145 (cdr #:*what*141)) (rest #:*what*145)) (declare (ignorable rest #:*what*145 o1 #:*what*144 v1 #:*what*143 #:*what*142)) (match0 (find v1 seq2 :key (function car)) ((list* _ o2) (cons (list v1 :type (sb-int:quasiquote (or #S(sb-impl::comma :expr (getf o1 :type) :kind 0) #S(sb-impl::comma :expr (getf o2 :type) :kind 0))) :place (or (getf o1 :place) (getf o2 :place)) :ignorable (or (getf o1 :ignorable) (getf o2 :ignorable))) (merge-variables rest seq2))))) nil))
Define a macro that eliminates this repetitive pattern:
(define-path-instruction-pair horizontal-to "H" (x))

Issue: 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 horizontal-to (x) (format-instruction "H" x)) (defun horizontal-to-r (x) (format-instruction "h" x)))
You are a Common Lisp macro expert. Given this code pattern:
(resolve
  nil
  nil)

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

Macro definition:
(defmacro RESOLVE ...)

Macroexpansion:
(locally
 (declare)
 (multiple-value-bind (#:assignment149 #:unified-p150)
     (type-unify 'nil 'nil (list))
   (assert #:unified-p150 nil 'simple-type-error :format-control
           "gtypes failed to unify to the actual types:~% ~a~%    against~% ~a"
           :format-arguments (list 'nil (list)))
   (let ()
     (declare (ignorable))
     nil
     nil)))
Write a Common Lisp macro to handle this code pattern:
(ltbdd-with-new-hash nil
  (progn))

Problem: Macro call that should be transformed by LTBDD-WITH-NEW-HASH

Macro definition:
(defmacro LTBDD-WITH-NEW-HASH ...)

Macroexpansion:
(bdd-call-with-new-hash (lambda () (progn)) :bdd-node-type
                        '(or lisp-type-bdd-node bdd-leaf))
Write a Common Lisp macro to handle this code pattern:
(defsynonym :generating :generate)

Problem: 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 :generating) (quote synonym)) (quote :generate)))
Write a Common Lisp macro to handle this code pattern:
(defpsmacro nil
    nil)

Problem: Macro call that should be transformed by DEFPSMACRO

Macro definition:
(defmacro DEFPSMACRO ...)

Macroexpansion:
(progn
 nil
 (eval-when (:compile-toplevel :load-toplevel :execute)
   (setf (gethash 'nil *macro-toplevel*)
           (lambda (#:|ps-macro-form-arg-194|)
             (destructuring-bind () (cdr #:|ps-macro-form-arg-194|))))
   (setf (gethash 'nil *macro-toplevel-lambda-list*) 'nil)
   'nil))
Generate a defmacro form that transforms code like this:
(define-port-value-slot nil (progn))

Pattern to recognize: Macro call that should be transformed by DEFINE-PORT-VALUE-SLOT

Macro definition:
(defmacro DEFINE-PORT-VALUE-SLOT ...)

Macroexpansion:
(progn
 (defmethod port-value ((nil nil)) (slot-value nil (progn)))
 (defmethod (setf port-value) (value (nil nil))
   (setf (slot-value nil (progn)) value))
 (defmethod port-value-boundp ((nil nil)) (slot-boundp nil '(progn)))
 (defmethod port-value-makunbound ((nil nil)) (slot-makunbound nil '(progn))))
Write a Common Lisp macro to handle this code pattern:
(do-generators ((g (some-numbers)) (:list l data :fill-value 0)) (yield (+ l g)))

Problem: 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 ((#:g132 (multi-gen (some-numbers) (list (list->generator data) :fill-value 0)))) (loop do (destructuring-bind (#:g134 . #:g133) (multiple-value-list (next-generator-value #:g132)) (unless #:g134 (return)) (let ((g (elt (elt #:g133 0) 0)) (l (elt (elt #:g133 1) 0))) (yield (+ l g))))))
Generate a defmacro form that transforms code like this:
(rem-arg-list-key-value! nil (progn))

Pattern to recognize: Macro call that should be transformed by REM-ARG-LIST-KEY-VALUE!

Macro definition:
(defmacro rem-arg-list-key-value! (ids place &key (test '#'equalper) (key '#'identity))
  `(progn
    (iter (for id in (ensure-list ,ids))
      (setf ,place (rem-arg-list-key-value id ,place :test ,test :key ,key)))
    ,place))

Macroexpansion:
(progn
 (iter
   (for id in (ensure-list nil))
   (setf (progn)
           (rem-arg-list-key-value id (progn) :test #'equalper :key
                                   #'identity)))
 (progn))
Create a Common Lisp macro for the following transformation. Before code:
(def-neo4j-fun set-relationship-properties (relationship-id properties) :put (:uri-spec (format nil "relationship/~A/properties" relationship-id)) (:encode properties :string) (:status-handlers (204 (values t body)) (400 (error 'invalid-data-sent-error :uri uri :json json)) (404 (error 'relationship-not-found-error :uri uri))))

What needs to change: 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 set-relationship-properties (&key relationship-id properties) (let ((uri (format nil "relationship/~A/properties" relationship-id)) (json (encode-neo4j-json-payload properties :string))) (make-neo4j-request :put uri json (list (list 204 (lambda (body uri json) (values t 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 relationship-not-found-error) :uri uri))))))))
Define a macro that eliminates this repetitive pattern:
(some-<>>
  nil
  nil)

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

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

Macroexpansion:
(let* ((#:var141 nil)
       (#:var142
        (if #:var141
            (nil #:var141)
            nil)))
  #:var142)
Write a Common Lisp macro to handle this code pattern:
(who-ps-html nil (progn))

Problem: Macro call that should be transformed by WHO-PS-HTML

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

Macroexpansion:
(stringify nil (progn))
Generate a defmacro form that transforms code like this:
(deftag :selfref (body attrs &key href &allow-other-keys) `(:a.selfref :href ,href ,@attrs ,@body))

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

Macro definition:
(defmacro deftag (name (body attrs-var &rest ll) &body tag)
  "Define NAME as a tag.
If NAME is not a keyword, it will also be defined as a macro with an
implicit `with-html'."
  (let ((definer
          (if (keywordp name)
              'deftag/keyword
              'deftag/macro)))
    `(,definer ,name (,body ,attrs-var ,@ll) ,@tag)))

Macroexpansion:
(deftag/keyword :selfref (body attrs &key href &allow-other-keys) (sb-int:quasiquote (:a.selfref :href #S(sb-impl::comma :expr href :kind 0) #S(sb-impl::comma :expr attrs :kind 2) #S(sb-impl::comma :expr body :kind 2))))
Write a Common Lisp macro to handle this code pattern:
(define-method-combination% progn :operator progn :identity-with-one-argument t)

Problem: Macro call that should be transformed by define-method-combination%

Macro definition:
(defmacro define-method-combination% (name &rest args)
  "Define a method-combination for the static-dispatch system only.

   Arguments are of the same form as to CL:DEFINE-METHOD-COMBINATION."

  `(eval-when (:compile-toplevel :load-toplevel :execute)
     (setf
      (combination-function ',name)
      ,(match args
         ((or nil
              (list* (and (type symbol) (not nil)) _))

          (destructuring-bind (&key (operator name) (identity-with-one-argument nil))
              args

            `(method-combination-function-short ,name ,operator ,identity-with-one-argument)))

         (_
          `(method-combination-function ,name ,@args))))))

Macroexpansion:
(eval-when (:compile-toplevel :load-toplevel :execute) (setf (combination-function (quote progn)) (method-combination-function-short progn progn t)))
Generate a defmacro form that transforms code like this:
(do-generator (item generator) (unless (funcall predicate item) (yield item) (return)))

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

Macro definition:
(defmacro do-generator ((var &rest vars-and-generator) &body body)
  "Steps through the specified generator, binding the value it returns to var, then executing the body for each step. If multiple variables are specified and the generator returns multiple values, the extra values will be bound to the extra variables."
  (let ((g (gensym)))
    `(let ((,g ,(car (last vars-and-generator))))
       (loop 
	  do (if-generator ((,var ,@(butlast vars-and-generator)) ,g)
			   (progn
			     ,@body)
			   (return))))))

Macroexpansion:
(let ((#:g160 generator)) (loop do (if-generator ((item) #:g160) (progn (unless (funcall predicate item) (yield item) (return))) (return))))
Create a Common Lisp macro for the following transformation. Before code:
(def-easy-macro nil
    nil)

What needs to change: Macro call that should be transformed by DEF-EASY-MACRO

Macro definition:
(defmacro DEF-EASY-MACRO ...)

Macroexpansion:
(progn
 (defun call-nil (#:|fn126|)
   (flet ((#:|fn126| (&rest args) (declare (inline)) (apply #:|fn126| args)))))
 (defmacro nil ((&rest fn-arg-values) &body macro-body)
   nil
   (build-funcall 'call-nil 'nil fn-arg-values macro-body)))
You are a Common Lisp macro expert. Given this code pattern:
(named-lambda fac (x) (if (> x 1) (* x (fac (- x 1))) x))

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

Macro definition:
(defmacro named-lambda (name lambda-list &body body)
  "Expands into a lambda-expression within whose BODY NAME denotes the
corresponding function."
  `(labels ((,name ,lambda-list ,@body))
     #',name))

Macroexpansion:
(function (named-lambda fac (x) (if (> x 1) (* x (fac (- x 1))) x)))
Write a Common Lisp macro to handle this code pattern:
(def-neo4j-fun del-relationship-property (relationship-id property) :delete (:uri-spec (format nil "relationship/~A/properties/~A" relationship-id (if (symbolp property) (string-downcase (symbol-name property)) property))) (:status-handlers (204 (values t body)) (404 (error 'relationship-not-found-error :uri uri))))

Problem: 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 del-relationship-property (&key relationship-id property) (let ((uri (format nil "relationship/~A/properties/~A" relationship-id (if (symbolp property) (string-downcase (symbol-name property)) property))) (json (encode-neo4j-json-payload nil :string))) (make-neo4j-request :delete uri json (list (list 204 (lambda (body uri json) (values t body))) (list 404 (lambda (body uri json) (error (quote relationship-not-found-error) :uri uri))))))))
Generate a defmacro form that transforms code like this:
(define-accumulation-binding summing ((var 0) form) (declare (type real var)) `(incf ,var ,form))

Pattern to recognize: Macro call that should be transformed by define-accumulation-binding

Macro definition:
(defmacro define-accumulation-binding (name (var &rest args) &body body)
  `(define-form-binding ,name (,var ,@args)
     ,@(form-fiddle:lambda-declarations `(lambda () ,@body))
     (values
      (progn ,@(form-fiddle:lambda-forms `(lambda () ,@body)))
      (delist var))))

Macroexpansion:
(define-form-binding summing ((var 0) form) (declare (type real var)) (values (progn (sb-int:quasiquote (incf #S(sb-impl::comma :expr var :kind 0) #S(sb-impl::comma :expr form :kind 0)))) (delist var)))
Create a Common Lisp macro for the following transformation. Before code:
(fail)

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

Macro definition:
(defmacro fail ()
  "Causes the latest pattern matching to fail.  After this failure,
matching continues at the next pattern."
  ;; FIXME: Don't raise an error but expand to %FAIL for the hack
  ;; above.
  ;(error "Not pattern matching.")
  '%fail)

Macroexpansion:
%fail
Generate a defmacro form that transforms code like this:
(assert-values ("baz w/lookup") (baz 2))

Pattern to recognize: Macro call that should be transformed by assert-values

Macro definition:
(defmacro assert-values ((desc) &body objects-and-values)
  `(progn
     (trc ,desc)
     ,@(loop for (obj val) in objects-and-values
	    collect `(assert (eql (value ,obj) ,val)))))

Macroexpansion:
(progn (trc "baz w/lookup") (assert (eql (value baz) 2)))
Generate a defmacro form that transforms code like this:
(enable-quasi-quoted-binary-to-binary-emitting-form-syntax nil)

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

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

Macroexpansion:
(eval-when (:compile-toplevel :execute)
  (setf *readtable* (copy-readtable *readtable*))
  (set-quasi-quoted-binary-to-binary-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
                                                                       "bin")
  (values))
Create a Common Lisp macro for the following transformation. Before code:
(true "ALARM!!")

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

Macro definition:
(defmacro true (form &optional description &rest format-args)
  `(eval-in-context
    *context*
    (make-instance 'comparison-result
                   :expression '(true ,form)
                   :value-form ',form
                   :body (lambda () ,form)
                   :expected 'T
                   :comparison 'geq
                   ,@(when description
                       `(:description (format NIL ,description ,@format-args))))))

Macroexpansion:
(eval-in-context *context* (make-instance (quote comparison-result) :expression (quote (true "ALARM!!")) :value-form (quote "ALARM!!") :body (lambda nil "ALARM!!") :expected (quote t) :comparison (quote geq)))
Write a Common Lisp macro to handle this code pattern:
(vect-of nil)

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

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

Macroexpansion:
(let ((#:vect137 (make-array 10 :adjustable t :fill-pointer 0)))
  (do-for nil
    (vector-push-extend nil #:vect137))
  #:vect137)
You are a Common Lisp macro expert. Given this code pattern:
(defsynonym finding :find)

Write a macro that addresses: 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 finding) (quote synonym)) (quote :find)))
Generate a defmacro form that transforms code like this:
(define-mustache-character #\^ (make-instance 'section-start-tag :text arg-text :end end :falsey t))

Pattern to recognize: 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 #\CIRCUMFLEX_ACCENT (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 section-start-tag) :text arg-text :end end :falsey t)))
Create a Common Lisp macro for the following transformation. Before code:
(undefreply nil (progn))

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

Macro definition:
(defmacro UNDEFREPLY ...)

Macroexpansion:
(undefine-reply 'nil :qualifiers 'nil :participants `(,progn))