cl-ds / test.jsonl
j14i's picture
Dataset splits: 4267 examples, 2985 train / 637 val / 645 test
f7383fa verified
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(letrec* 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by LETREC*", "input": "(letrec* 'lol-gen::some-name)", "output": "(defmacro letrec* ((&rest bindings) &body body)\n \"Like LETREC, but the bindings are evaluated in order.\nSee Waddell et al., *Fixing Letrec* for motivation.\n\nCf. `fbindrec*'.\"\n `(letrec-with setq ,bindings\n ,@body))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(collect-stream nil (progn))\n\nIssue: Macro call that should be transformed by COLLECT-STREAM", "input": "(collect-stream nil (progn))", "output": "(defmacro COLLECT-STREAM ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(cond->> nil)\n\nWrite a macro that addresses: Macro call that should be transformed by COND->>", "input": "(cond->> nil)", "output": "(defmacro cond->> (init &body exps) (cond-arrow-macro init exps t))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(defclass/std nil :key nil)\n\nProblem: Macro call that should be transformed by DEFCLASS/STD", "input": "(defclass/std nil :key nil)", "output": "(defmacro defclass/std (name direct-superclasses direct-slots &rest options\n &environment env)\n \"Shortcut macro to the DEFCLASS macro.\n\n (defclass/std example ()\n ((slot1 slot2 slot3)))\n\n expands to:\n\n (DEFCLASS EXAMPLE ()\n ((SLOT1 :ACCESSOR SLOT1 :INITARG :SLOT1 :INITFORM NIL)\n (SLOT2 :ACCESSOR SLOT2 :INITARG :SLOT2 :INITFORM NIL)\n (SLOT3 :ACCESSOR SLOT3 :INITARG :SLOT3 :INITFORM NIL)))\n\n Each slot definition accepts options:\n\n :std 1 => changes the :initform to 1. It can be :unbound.\n :with or :with-prefix => creates accessors with the class name as prefix.\n\n See the README for more.\n\n See also `class/std' and `print-object/std'.\n \"\n `(defclass ,name ,direct-superclasses\n ,(process-slots env direct-slots name)\n ,@options))", "category": "dsl", "technique": "recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Generate a defmacro form that transforms code like this:\n(-<>> nil)\n\nPattern to recognize: Macro call that should be transformed by -<>>", "input": "(-<>> nil)", "output": "(defmacro -<>> (init &body exps) (diamond-wand init exps t))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(remf nil (progn))\n\nProblem: Macro call that should be transformed by REMF", "input": "(remf nil (progn))", "output": "(defmacro REMF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(define-reader)\n\nIssue: Macro call that should be transformed by DEFINE-READER", "input": "(define-reader)", "output": "(defmacro define-reader (&key file-reader string-reader macro-character)\n `(progn\n (defun ,file-reader (file &key (debug nil))\n \"Read c-mera source file and return AST\"\n (let ((asts nil)\n\t (*readtable* (copy-readtable nil)))\n\t ;; Preserve case, and parse convenient stuff\n\t (setf (readtable-case *readtable*) :invert)\n\t ,@macro-character\n\t ;(handler-case\n\t (with-open-file (in file)\n\t (loop for s-expr = (read in nil nil nil) while s-expr do ;; TODO CHECK call\n\t\t (let* ((s-expr (eval s-expr))\n\t\t\t (evaluated (if (listp s-expr)\n\t\t\t\t\t s-expr\n\t\t\t\t\t (list s-expr))))\n\t\t (when (typep (car evaluated) 'node)\n\t\t\t(setf asts (append asts evaluated))))))\n\n\t ;; TODO\n\t ;; Standard clozure error handling breaks console.\n\t ;; This hanlder-case is only a tentative fix \n\t ;#+clozure (error (err) (let ((*print-pretty* t))\n\t ;\t\t\t (format *error-output* \"~a\" err))))\n\t ;; Return single AST\n\t (nodelist asts)))\n (defun ,string-reader (str)\n \"Rread c-mera source string and return AST\"\n (let ((asts nil)\n\t (*readtable* (copy-readtable nil)))\n\t ;; Preserve case, and parse convenient stuff\n\t (setf (readtable-case *readtable*) :invert)\n\t ,@macro-character\n\t ;(handler-case\n\t (let* ((s-expr (eval (read-from-string str)))\n\t\t (evaluated (if (listp s-expr)\n\t\t\t\t s-expr\n\t\t\t\t (list s-expr))))\n\t (when (typep (car evaluated) 'node)\n\t\t (setf asts evaluated)))\n\n\t ;; TODO\n\t ;; Standard clozure error handling breaks console.\n\t ;; This hanlder-case is only a tentative fix \n\t ;#+clozure (error (err) (let ((*print-pretty* t))\n\t ;\t\t\t (format *error-output* \"~a\" err))))\n\t ;; Return single AST\n\t (nodelist asts)))))", "category": "dsl", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(cll-outer nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by CLL-OUTER", "input": "(cll-outer nil\n (progn))", "output": "(defmacro cll-outer (val &body body)\n `(let ((outer-val ,val))\n ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(query 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by QUERY", "input": "(query 'lol-gen::some-name)", "output": "(defmacro query (query &rest args/format)\n \"Execute the given query, which can be either a string or an S-SQL form (list\nstarting with a keyword). If the query contains placeholders ($1, $2, etc)\ntheir values can be given as extra arguments. If one of these arguments is a\nkeyword occurring in the table below, it will not be used as a query\nargument, but will determine the format in which the results are returned\ninstead. Any of the following formats can be used, with the default being :rows:\n\n| :none\t | Ignore the result values. |\n| :lists, :rows | Return a list of lists, each list containing the values |\n| | for a row. |\n| :list, :row | Return a single row as a list. |\n| :alists\t | Return a list of alists which map column names to values, |\n| | with the names represented as keywords. |\n| :alist\t | Return a single row as an alist. |\n| :array-hash | Return an array of hashtables which map column names to |\n| | hash table keys. NOTE: It will return an empty array |\n| | if there is no result. |\n| :vectors | Returns a vector of vectors where each internal vector is |\n| | a returned row from the query. The field names are not |\n| | included. NOTE: It will return an empty vector instead of |\n| | NIL if there is no result. |\n| :str-alists | Like :alists, but use the original column names. |\n| :str-alist\t | Return a single row as an alist, with strings for names. |\n| :plists\t | Return a list of plists which map column names to values, |\n| | with the names represented as keywords. |\n| :plist\t | Return a single row as a plist. |\n| :column\t | Return a single column as a list. |\n| :single\t | Return a single value. |\n| :single!\t | Like :single, but raise an error when the number of |\n| | selected rows is not equal to 1. |\n| (:dao type)\t | Return a list of DAOs of the given type. The names of the |\n| | fields returned by the query must match slots in the DAO |\n| | class the same way as with query-dao. |\n| (:dao type :single)| Return a single DAO of the given type. |\n| :json-strs | Return a list of strings where each row is a json object |\n| | expressed as a string |\n| :json-str | Return a single string where the row returned is a json |\n| | object expressed as a string. |\n| :json-array-str | Return a string containing a json array, each element in |\n| | the array is a selected row expressed as a json object. |\n| | NOTE: If there is no result, it will return a string with |\n| | an empty json array. |\n\nIf the database returns information about the amount rows that were affected,\nsuch as with updating or deleting queries, this is returned as a second value.\"\n (let* ((format :rows)\n (args (loop :for arg :in args/format\n :if (or (dao-spec-for-format arg)\n (assoc arg *result-styles*)) :do (setf format arg)\n :else :collect arg)))\n (destructuring-bind (reader result-form) (reader-for-format format)\n (let ((base (if args\n\t\t (let ((vars (loop :for x :in args :collect (gensym))))\n\t\t\t`(let ,(loop :for v :in vars :for a :in args :collect `(,v ,a))\n\t\t\t (prepare-query *database* \"\" ,(real-query query) (list ,@vars))\n\t\t\t (exec-prepared *database* \"\" (list ,@vars) ,reader)))\n\t\t `(exec-query *database* ,(real-query query) ,reader))))\n `(,result-form ,base)))))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.835}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(nor)\n\nProblem: Macro call that should be transformed by NOR", "input": "(nor)", "output": "(defmacro nor (&rest forms)\n \"Equivalent to (not (or ...)).\n\nFrom Arc.\"\n (if (null forms) t\n (if (null (rest forms))\n `(not ,(first forms))\n `(if ,(first forms)\n nil\n (nor ,@(rest forms))))))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.815}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(once-on nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by ONCE-ON", "input": "(once-on nil\n :key\n nil)", "output": "(defmacro once-on (hook args &body body)\n \"Attach a handler with ARGS and BODY to the HOOK.\n\nRemove the handler after it fires the first time.\n\nSee `on'.\"\n (let ((handler-name (gensym \"once-on-hook-handler\"))\n (args (alexandria:ensure-list args)))\n (alexandria:once-only (hook)\n `(add-hook\n ,hook (make-instance 'handler\n :fn (lambda ,args\n (declare (ignorable ,@args))\n (remove-hook ,hook (quote ,handler-name))\n ,@body)\n :name (quote ,handler-name))))))", "category": "anaphoric", "technique": "once-only,gensym,anaphor", "complexity": "intermediate", "quality_score": 0.7975}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(dynamic-extent 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by DYNAMIC-EXTENT", "input": "(dynamic-extent 'lol-gen::some-name)", "output": "(defmacro DYNAMIC-EXTENT ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(when nil :key nil)\n\nPattern to recognize: Macro call that should be transformed by WHEN", "input": "(when nil :key nil)", "output": "(defmacro WHEN ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(auto-permute-typecase 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by AUTO-PERMUTE-TYPECASE", "input": "(auto-permute-typecase 'lol-gen::some-name)", "output": "(defmacro AUTO-PERMUTE-TYPECASE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(doquery nil\n nil)\n\nWhat needs to change: Macro call that should be transformed by DOQUERY", "input": "(doquery nil\n nil)", "output": "(defmacro doquery (query (&rest names) &body body)\n \"Execute the given query (a string or a list starting with a keyword),\niterating over the rows in the result. The body will be executed with the values\nin the row bound to the symbols given in names. To iterate over a\nparameterised query, one can specify a list whose car is the query, and whose\ncdr contains the arguments. For example:\n\n(doquery (:select 'name 'score :from 'scores) (n s)\n (incf (gethash n *scores*) s))\n\n(doquery ((:select 'name :from 'scores :where (:> 'score '$1)) 100) (name)\n (print name))\"\n (let* ((fields (gensym))\n (query-name (gensym))\n args\n (reader-expr\n `(row-reader (,fields)\n (unless (= ,(length names) (length ,fields))\n (error \"Number of field names does not match number of selected fields in query ~A.\"\n ,query-name))\n (loop :while (next-row)\n :do (let ,(loop :for i :from 0\n :for name :in names\n :collect `(,name (next-field (elt ,fields ,i))))\n ,@body)))))\n (when (and (consp query) (not (keywordp (first query))))\n (setf args (cdr query) query (car query)))\n (if args\n `(let ((,query-name ,(real-query query)))\n (prepare-query *database* \"\" ,query-name (list ,@args))\n (exec-prepared *database* \"\" (list ,@args) ,reader-expr))\n `(let ((,query-name ,(real-query query)))\n (exec-query *database* ,query-name ,reader-expr)))))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.835}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(f-zerop 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by F-ZEROP", "input": "(f-zerop 'lol-gen::some-name)", "output": "(defmacro f-zerop (key &rest body)\n `(with-synapse ,key (prior-fire-value) \n (let ((new-basis (progn ,@body)))\n (values new-basis (if (xor prior-fire-value (zerop new-basis))\n (progn\n (setf prior-fire-value (zerop new-basis))\n :propagate)\n :no-propagate)))))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(defmethod 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by DEFMETHOD", "input": "(defmethod 'lol-gen::some-name)", "output": "(defmacro defmethod (name &rest args)\n (handler-case\n (multiple-value-bind (qualifiers specializers lambda-list body)\n (parse-method args)\n\n (declare (ignore qualifiers))\n\n (with-gensyms (method)\n (let ((fn-name (gentemp (symbol-name (block-name name)) *method-function-package*)))\n `(progn\n ,(make-method-function name fn-name lambda-list body)\n\n (let ((,method\n (walk-environment\n (c2mop:defmethod ,name ,@args))))\n\n (when (combination-options ',name)\n ,(make-add-method-info name method fn-name body)\n ,(make-static-dispatch name lambda-list specializers))\n\n ,method)))))\n\n (error (e)\n (simple-style-warning \"Error parsing DEFMETHOD form:~%~2T~a\" e)\n `(walk-environment\n (c2mop:defmethod ,name ,@args)))))", "category": "capture-management", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(lret nil)\n\nIssue: Macro call that should be transformed by LRET", "input": "(lret nil)", "output": "(defmacro lret ((&rest bindings) &body body)\n \"Return the initial value of the last binding in BINDINGS. The idea\nis to create something, initialize it, and then return it.\n\n (lret ((x 1)\n (y (make-array 1)))\n (setf (aref y 0) x))\n => #(1)\n\nNote that the value returned is the value initially bound. Subsequent\nassignments are ignored.\n\n (lret ((x 1))\n (setf x 2))\n => 1\n\nFurthermore, on Lisps that support it, the variable may be made\nread-only, making assignment a compiler-time error.\n\n`lret' may seem trivial, but it fufills the highest purpose a macro\ncan: it eliminates a whole class of bugs (initializing an object, but\nforgetting to return it).\n\nCf. `aprog1' in Anaphora.\"\n `(lret-aux let ,bindings\n ,@body))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(lambda-cmatch\n common-lisp:nil\n :key\n common-lisp:nil)\n\nWhat needs to change: Macro call that should be transformed by LAMBDA-CMATCH", "input": "(lambda-cmatch\n common-lisp:nil\n :key\n common-lisp:nil)", "output": "(defmacro lambda-cmatch (&body body)\n \"Equivalent to (lambda (arg) (cmatch arg BODY...)).\"\n (multiple-value-bind (preamble clauses) (parse-matcher-body body)\n (with-gensyms (clause)\n `(lambda (,clause)\n ,@preamble\n (cmatch ,clause\n ,@clauses)))))", "category": "capture-management", "technique": "gensym", "complexity": "basic", "quality_score": 0.8999999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(ignoring nil)\n\nProblem: Macro call that should be transformed by IGNORING", "input": "(ignoring nil)", "output": "(defmacro ignoring (type &body body)\n \"DEPRECATED: use `alexandria:ignore-some-conditions' instead.\"\n (simple-style-warning \"~s is deprecated, use ~s instead\"\n 'ignoring 'ignore-some-conditions)\n `(ignore-some-conditions (,type)\n ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(cond-bind nil\n (progn))\n\nIssue: Macro call that should be transformed by COND-BIND", "input": "(cond-bind nil\n (progn))", "output": "(defmacro COND-BIND ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with-compilation-unit nil (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by WITH-COMPILATION-UNIT", "input": "(with-compilation-unit nil (progn))", "output": "(defmacro WITH-COMPILATION-UNIT ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(from nil nil)\n\nWrite a macro that addresses: Macro call that should be transformed by FROM", "input": "(from nil nil)", "output": "(defmacro from (&rest statements)\n `(make-clause :from ,@(mapcar #'expand-op statements)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(product-of 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by PRODUCT-OF", "input": "(product-of 'lol-gen::some-name)", "output": "(defmacro PRODUCT-OF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(collecting)\n\nWrite a macro that addresses: Macro call that should be transformed by COLLECTING", "input": "(collecting)", "output": "(defmacro collecting (&body body)\n \"Like `with-collector', with the collector bound to the result of\ninterning `collect' in the current package.\"\n (with-current-package-symbols (collect)\n `(with-collector (,collect)\n ,@body)))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(defgeneric nil nil)\n\nPattern to recognize: Macro call that should be transformed by DEFGENERIC", "input": "(defgeneric nil nil)", "output": "(defmacro DEFGENERIC ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(pipe common-lisp:nil (common-lisp:progn))\n\nWrite a macro that addresses: Macro call that should be transformed by PIPE", "input": "(pipe common-lisp:nil (common-lisp:progn))", "output": "(defmacro pipe (cl:&rest items)\n \"A syntactic convenience for function application, sometimes called a \\\"threading macro\\\". Transform\n\n (pipe x h g f)\n\nto\n\n (f (g (h x))).\"\n (cl:assert (cl:<= 2 (cl:list-length items)))\n `(nest ,@(cl:reverse items)))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "intermediate", "quality_score": 0.8999999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(tree-ecase nil)\n\nWhat needs to change: Macro call that should be transformed by TREE-ECASE", "input": "(tree-ecase nil)", "output": "(defmacro TREE-ECASE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(fail-compile nil nil)\n\nIssue: Macro call that should be transformed by FAIL-COMPILE", "input": "(fail-compile nil nil)", "output": "(defmacro fail-compile (form &optional (type 'error) description &rest format-args)\n `(eval-in-context\n *context*\n (make-instance 'comparison-result\n :expression '(fail-expansion ,form)\n :value-form '(nth-value 3 (try-compile ',form ',type))\n :body (lambda () (nth-value 3 (try-compile ',form ',type)))\n :expected ',(maybe-unquote type)\n :comparison 'typep\n ,@(when description\n `(:description (format NIL ,description ,@format-args))))))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(.< common-lisp:nil (common-lisp:progn))\n\nWhat needs to change: Macro call that should be transformed by .<", "input": "(.< common-lisp:nil (common-lisp:progn))", "output": "(defmacro .< (cl:&rest items)\n \"Right associative compose operator. Creates a new functions that will run the\nfunctions right to left when applied. This is the same as the `nest` macro without supplying\nthe value. The composition is thus the same order as `compose`.\n\n`(.< f g h)` creates the function `(fn (x) (f (g (h x))))`.\"\n (alexandria:with-gensyms (x)\n `(fn (,x)\n (nest ,@items ,x))))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.85}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(cond-<>\n nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by COND-<>", "input": "(cond-<>\n nil\n :key\n nil)", "output": "(defmacro COND-<> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(f_%\n nil)\n\nPattern to recognize: Macro call that should be transformed by F_%", "input": "(f_%\n nil)", "output": "(defmacro F_% ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(returning nil)\n\nIssue: Macro call that should be transformed by RETURNING", "input": "(returning nil)", "output": "(defmacro RETURNING ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-unique-names nil\n nil)\n\nIssue: Macro call that should be transformed by WITH-UNIQUE-NAMES", "input": "(with-unique-names nil\n nil)", "output": "(defmacro with-unique-names (names &body body)\n `(let ,(mapcar (lambda (sym)\n `(,sym (gensym ,(symbol-name sym))))\n names)\n ,@body))", "category": "capture-management", "technique": "gensym", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(ignorable common-lisp:nil\n common-lisp:nil)\n\nWrite a macro that addresses: Macro call that should be transformed by IGNORABLE", "input": "(ignorable common-lisp:nil\n common-lisp:nil)", "output": "(defmacro IGNORABLE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(destructuring-match nil\n (progn))\n\nPattern to recognize: Macro call that should be transformed by DESTRUCTURING-MATCH", "input": "(destructuring-match nil\n (progn))", "output": "(defmacro DESTRUCTURING-MATCH ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(yield-all 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by YIELD-ALL", "input": "(yield-all 'lol-gen::some-name)", "output": "(defmacro yield-all (generator)\n \"Walks through generator, re-yielding all of the items in it. Only meant for use inside of a defgenerator or with-yield block.\"\n (let ((x (gensym)))\n `(do-generator (,x ,generator)\n (yield ,x))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "basic", "quality_score": 0.7999999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(product-of nil\n (progn))\n\nIssue: Macro call that should be transformed by PRODUCT-OF", "input": "(product-of nil\n (progn))", "output": "(defmacro PRODUCT-OF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(lambda-cmatch1 common-lisp:nil\n (common-lisp:progn))\n\nWhat needs to change: Macro call that should be transformed by LAMBDA-CMATCH1", "input": "(lambda-cmatch1 common-lisp:nil\n (common-lisp:progn))", "output": "(defmacro lambda-cmatch1 (pattern &body body)\n \"Equivalent to (lambda (arg) (cmatch arg (PATTERN BODY...))).\"\n `(lambda-cmatch (,pattern ,@body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.875}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(with-accessors nil\n nil)\n\nProblem: Macro call that should be transformed by WITH-ACCESSORS", "input": "(with-accessors nil\n nil)", "output": "(defmacro WITH-ACCESSORS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(some-<> nil\n (progn))\n\nIssue: Macro call that should be transformed by SOME-<>", "input": "(some-<> nil\n (progn))", "output": "(defmacro some-<> (init &body exps) (diamond-wand init exps nil t))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(awhen nil\n :key\n nil)\n\nProblem: Macro call that should be transformed by AWHEN", "input": "(awhen nil\n :key\n nil)", "output": "(defmacro AWHEN ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(-> nil nil)\n\nWhat needs to change: Macro call that should be transformed by ->", "input": "(-> nil nil)", "output": "(defmacro -> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-output-to-file 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by WITH-OUTPUT-TO-FILE", "input": "(with-output-to-file 'lol-gen::some-name)", "output": "(defmacro with-output-to-file ((stream-name file-name &rest args\n &key (direction nil direction-p)\n &allow-other-keys)\n\t\t\t &body body)\n \"Evaluate BODY with STREAM-NAME to an output stream on the file\nFILE-NAME. ARGS is sent as is to the call to OPEN except EXTERNAL-FORMAT,\nwhich is only sent to WITH-OPEN-FILE when it's not NIL.\"\n (declare (ignore direction))\n (when direction-p\n (error \"Can't specify :DIRECTION for WITH-OUTPUT-TO-FILE.\"))\n `(with-open-file* (,stream-name ,file-name :direction :output ,@args)\n ,@body))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(max-of nil\n (progn))\n\nProblem: Macro call that should be transformed by MAX-OF", "input": "(max-of nil\n (progn))", "output": "(defmacro MAX-OF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(-> 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by ->", "input": "(-> 'lol-gen::some-name)", "output": "(defmacro -> (x &rest forms)\n \"Threads the expr through FORMS. Inserts X as the\n second item in the first form, or in place of % if it is present in the form,\n making a list of it if it is not a list already.\n If there are more forms, inserts the first form\n as the second item in second form, etc.\"\n (if (first forms)\n (let* ((form (first forms))\n (threaded (if (listp form)\n (if (member '% form)\n `(funcall (lambda (%) ,form) ,x)\n `(,(first form) ,x ,@(rest form)))\n `(,form ,x))))\n `(-> ,threaded ,@(rest forms)))\n x))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "intermediate", "quality_score": 0.885}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(maxf nil)\n\nIssue: Macro call that should be transformed by MAXF", "input": "(maxf nil)", "output": "(defmacro MAXF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(with-hook-restart\n nil)\n\nProblem: Macro call that should be transformed by WITH-HOOK-RESTART", "input": "(with-hook-restart\n nil)", "output": "(defmacro with-hook-restart (&body body)\n `(with-simple-restart (continue \"Call next function in hook ~s\" *hook*)\n ,@body))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(string-ecase nil\n nil)\n\nIssue: Macro call that should be transformed by STRING-ECASE", "input": "(string-ecase nil\n nil)", "output": "(defmacro STRING-ECASE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(returning nil)\n\nWrite a macro that addresses: Macro call that should be transformed by RETURNING", "input": "(returning nil)", "output": "(defmacro returning (&rest expressions)\n `(apply #'make-clause :returning\n (list ,@(mapcar (lambda (expr)\n (if (and (listp expr)\n (keywordp (car expr)))\n (expand-op expr)\n `,expr))\n expressions))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(bcond\n nil\n (progn))\n\nPattern to recognize: Macro call that should be transformed by BCOND", "input": "(bcond\n nil\n (progn))", "output": "(defmacro bcond (&body clauses)\n \"Scheme's extended COND.\n\nThis is exactly like COND, except for clauses having the form\n\n (test :=> recipient)\n\nIn that case, if TEST evaluates to a non-nil result, then RECIPIENT, a\nfunction, is called with that result, and the result of RECIPIENT is\nreturn as the value of the `cond`.\n\nAs an extension, a clause like this:\n\n (test :=> var ...)\n\nCan be used as a shorthand for\n\n (test :=> (lambda (var) ...))\n\nThe name `bcond' for a \u201cbinding cond\u201d goes back at least to the days\nof the Lisp Machines. I do not know who was first to use it, but the\noldest examples I have found are by Michael Parker and Scott L.\nBurson.\"\n (flet ((send-clause? (clause)\n (let ((second (second clause)))\n (and (symbolp second)\n (string= second :=>))))\n (parse-send-clause (clause)\n (destructuring-bind (test => . body) clause\n (declare (ignore =>))\n (cond ((null body) (error \"Missing clause\"))\n ((null (rest body))\n (values test (car body)))\n (t (destructuring-bind (var . body) body\n (let ((fn `(lambda (,var) ,@body)))\n (values test fn))))))))\n ;; Note that we expand into `cond' rather than `if' so we don't\n ;; have to handle tests without bodies.\n (cond ((null clauses) nil)\n ((member-if #'send-clause? clauses)\n (let* ((tail (member-if #'send-clause? clauses))\n (preceding (ldiff clauses tail))\n (clause (car tail))\n (clauses (cdr tail)))\n (multiple-value-bind (test fn)\n (parse-send-clause clause)\n (with-gensyms (tmp)\n `(cond ,@preceding\n (t (if-let1 ,tmp ,test\n (funcall ,fn ,tmp)\n (bcond ,@clauses))))))))\n (t `(cond ,@clauses)))))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.835}
{"instruction": "Generate a defmacro form that transforms code like this:\n(nth-value-or nil\n (progn))\n\nPattern to recognize: Macro call that should be transformed by NTH-VALUE-OR", "input": "(nth-value-or nil\n (progn))", "output": "(defmacro nth-value-or (nth-value &body forms)\n \"Evaluates FORM arguments one at a time, until the NTH-VALUE returned by one\nof the forms is true. It then returns all the values returned by evaluating\nthat form. If none of the forms return a true nth value, this form returns\nNIL.\"\n (once-only (nth-value)\n (with-gensyms (values)\n `(let ((,values (multiple-value-list ,(first forms))))\n (if (nth ,nth-value ,values)\n (values-list ,values)\n ,(if (rest forms)\n `(nth-value-or ,nth-value ,@(rest forms))\n nil))))))", "category": "anaphoric", "technique": "once-only,gensym,anaphor,recursive-expansion", "complexity": "intermediate", "quality_score": 0.8225}
{"instruction": "Generate a defmacro form that transforms code like this:\n(eval-always\n nil)\n\nPattern to recognize: Macro call that should be transformed by EVAL-ALWAYS", "input": "(eval-always\n nil)", "output": "(defmacro eval-always (&body body)\n \"Wrap BODY in eval-when with all keys (compile, load and execute) mentioned.\"\n `(eval-when (:compile-toplevel :load-toplevel :execute)\n ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(define-templated-dispatch nil\n nil)\n\nIssue: Macro call that should be transformed by DEFINE-TEMPLATED-DISPATCH", "input": "(define-templated-dispatch nil\n nil)", "output": "(defmacro DEFINE-TEMPLATED-DISPATCH ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(~>> nil nil)\n\nPattern to recognize: Macro call that should be transformed by ~>>", "input": "(~>> nil nil)", "output": "(defmacro ~>> (needle &rest holes)\n \"Like `~>' but, by default, thread NEEDLE as the last argument\ninstead of the first.\"\n (thread-aux '~>> needle holes\n (lambda (needle hole)\n (append hole (list needle)))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(abbr nil (progn))\n\nPattern to recognize: Macro call that should be transformed by ABBR", "input": "(abbr nil (progn))", "output": "(defmacro abbr (short long &optional lambda-list)\n \"Abbreviate LONG macro or function name as SHORT.\n If LAMBDA-LIST is present, also copy appropriate SETF-expander.\"\n `(eval-always\n ;; Lispworks signals error while abbreviating to keywords\n ;; SBCL has package locks when accessing built-in functionality\n ;; other similar things are probably possible in other implementations\n (handler-bind ((error (lambda (e)\n (let ((r (find-restart 'continue e)))\n (when r\n (warn 'rutils-style-warning\n :format-control\n \"Skipped error during abbreviation: ~A\"\n :format-arguments (list e))\n (invoke-restart r))))))\n (cond\n ((macro-function ',long)\n (setf (macro-function ',short) (macro-function ',long))\n #+ccl (setf (ccl:arglist ',short) (ccl:arglist ',long)))\n ((special-operator-p ',long)\n (error \"Can't abbreviate a special-operator ~a\" ',long))\n ((fboundp ',long)\n (setf (fdefinition ',short) (fdefinition ',long))\n #+ccl (setf (ccl:arglist ',short) (ccl:arglist ',long))\n ,(when lambda-list\n `(define-setf-expander ,short ,lambda-list\n (values ,@(multiple-value-bind\n (dummies vals store store-form access-form)\n (get-setf-expansion\n (cons long (remove-if (lambda (sym)\n (member sym '(&optional &key)))\n lambda-list)))\n (let ((expansion-vals (mapcar (lambda (x) `(quote ,x))\n (list dummies\n vals\n store\n store-form\n access-form))))\n (setf (second expansion-vals)\n (cons 'list vals))\n expansion-vals))))))\n (t\n (error \"Can't abbreviate ~a\" ',long)))\n (setf (documentation ',short 'function) (documentation ',long 'function))\n ',short)))", "category": "dsl", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(live\n nil)\n\nProblem: Macro call that should be transformed by LIVE", "input": "(live\n nil)", "output": "(defmacro live (&body forms)\n \"Define a live block consisting of FORMS.\n\nThe FORMS are evaluated once when the LIVE form is first evaluated,\nafter which they are evaluated again whenever the values of the cells\nreferenced by them change. Cells may be referenced either directly in\nFORMS or by a function called during the evaluation of FORMS.\n\nReturns a function which when called, stops the live block. Once\nstopped the live block will no longer be called when the values of the\nreferenced cells change.\"\n\n (let ((spec (make-instance 'watch-function-spec :body forms)))\n (generate-watch-function spec)))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(doc 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by DOC", "input": "(doc 'lol-gen::some-name)", "output": "(defmacro DOC ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(as-> nil nil)\n\nProblem: Macro call that should be transformed by AS->", "input": "(as-> nil nil)", "output": "(defmacro AS-> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(swhen nil\n (progn))\n\nWhat needs to change: Macro call that should be transformed by SWHEN", "input": "(swhen nil\n (progn))", "output": "(defmacro swhen (test &body body)\n \"Like WHEN, except binds the test form to IT (via SYMBOL-MACROLET) for the\nscope of the body. IT can be set with SETF.\"\n `(symbolic when ,test ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(c?_\n nil\n :key\n nil)\n\nProblem: Macro call that should be transformed by C?_", "input": "(c?_\n nil\n :key\n nil)", "output": "(defmacro c?_ (&body body)\n `(make-c-dependent\n :code ',body\n :value-state :unevaluated\n :lazy t\n :rule (c-lambda ,@body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(without-dependency-capture)\n\nProblem: Macro call that should be transformed by WITHOUT-DEPENDENCY-CAPTURE", "input": "(without-dependency-capture)", "output": "(defmacro WITHOUT-DEPENDENCY-CAPTURE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(enable-quasi-quoted-list-syntax)\n\nWrite a macro that addresses: Macro call that should be transformed by ENABLE-QUASI-QUOTED-LIST-SYNTAX", "input": "(enable-quasi-quoted-list-syntax)", "output": "(defmacro ENABLE-QUASI-QUOTED-LIST-SYNTAX ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(deftype nil ())\n\nIssue: Macro call that should be transformed by DEFTYPE", "input": "(deftype nil ())", "output": "(defmacro DEFTYPE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(defparam nil (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by DEFPARAM", "input": "(defparam nil (progn))", "output": "(defmacro DEFPARAM ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(make-method nil)\n\nWrite a macro that addresses: Macro call that should be transformed by MAKE-METHOD", "input": "(make-method nil)", "output": "(defmacro MAKE-METHOD ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(some->> nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by SOME->>", "input": "(some->> nil\n nil)", "output": "(defmacro some->> (init &body exps) (arrow-macro init exps t t))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with-input-from-file 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by WITH-INPUT-FROM-FILE", "input": "(with-input-from-file 'lol-gen::some-name)", "output": "(defmacro with-input-from-file ((stream-name file-name &rest args\n &key (direction nil direction-p)\n &allow-other-keys)\n &body body)\n \"Evaluate BODY with STREAM-NAME to an input stream on the file\nFILE-NAME. ARGS is sent as is to the call to OPEN except EXTERNAL-FORMAT,\nwhich is only sent to WITH-OPEN-FILE when it's not NIL.\"\n (declare (ignore direction))\n (when direction-p\n (error \"Can't specify :DIRECTION for WITH-INPUT-FROM-FILE.\"))\n `(with-open-file* (,stream-name ,file-name :direction :input ,@args)\n ,@body))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Generate a defmacro form that transforms code like this:\n(with-special-initargs nil\n :key\n nil)\n\nPattern to recognize: Macro call that should be transformed by WITH-SPECIAL-INITARGS", "input": "(with-special-initargs nil\n :key\n nil)", "output": "(defmacro WITH-SPECIAL-INITARGS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(with-capped-stack nil\n nil)\n\nWhat needs to change: Macro call that should be transformed by WITH-CAPPED-STACK", "input": "(with-capped-stack nil\n nil)", "output": "(defmacro with-capped-stack (() &body body)\n `(stack-capper (lambda () ,@body)))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(ensure-functionf 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by ENSURE-FUNCTIONF", "input": "(ensure-functionf 'lol-gen::some-name)", "output": "(defmacro ensure-functionf (&rest places)\n \"Multiple-place modify macro for ENSURE-FUNCTION: ensures that each of\nPLACES contains a function.\"\n `(progn ,@(mapcar (lambda (x) `(ensure-functionf/1 ,x)) places)))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.8999999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(define-test+run nil\n nil)\n\nProblem: Macro call that should be transformed by DEFINE-TEST+RUN", "input": "(define-test+run nil\n nil)", "output": "(defmacro define-test+run (name &body args-and-body)\n `(progn\n (define-test ,name ,@args-and-body)\n (eval-when (:execute)\n (let* ((*silence-plain-compilation-errors-p* nil) ; must be let*! the order matters!\n (report (test ',name :report 'plain)))\n (if (member (status report) '(:passed :skipped))\n report\n (values report\n (loop for result across (results report)\n when (and (not (typep result 'test-result))\n (eql :failed (status result)))\n collect (expression result))))))))", "category": "dsl", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(defun-ematch* common-lisp:nil\n :key\n common-lisp:nil)\n\nWhat needs to change: Macro call that should be transformed by DEFUN-EMATCH*", "input": "(defun-ematch* common-lisp:nil\n :key\n common-lisp:nil)", "output": "(defmacro defun-ematch* (name args &body body)\n \"Equivalent to (defun (arg) [decl-and-docstring] (ematch arg (PATTERN BODY...))).\"\n (multiple-value-bind (preamble clauses) (parse-matcher-body body)\n `(defun ,name ,args\n ,@preamble\n (ematch* ,args\n ,@clauses))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8999999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(define-values nil\n (progn))\n\nWhat needs to change: Macro call that should be transformed by DEFINE-VALUES", "input": "(define-values nil\n (progn))", "output": "(defmacro define-values (values &body (expr))\n \"Like `def', but for multiple values.\nEach variable in VALUES is given a global, lexical binding, as with\n`def', then set all at once, as with `multiple-value-setq'.\"\n `(progn\n ,@(loop for v in values collect `(def ,v nil))\n (setf (values ,@values) ,expr)\n (values ,@(loop for v in values collect `(quote ,v)))))", "category": "dsl", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Generate a defmacro form that transforms code like this:\n(sort-values nil :key nil)\n\nPattern to recognize: Macro call that should be transformed by SORT-VALUES", "input": "(sort-values nil :key nil)", "output": "(defmacro sort-values (pred &rest values)\n \"Sort VALUES with PRED and return as multiple values.\n\nEquivalent to\n\n (values-list (sort (list VALUES...) pred))\n\nBut with less consing, and potentially faster.\"\n ;; Remember to evaluate `pred' no matter what.\n (with-gensyms (gpred)\n `(let ((,gpred (ensure-function ,pred)))\n (declare (ignorable ,gpred)\n (function ,gpred)\n (optimize (safety 1) (debug 0) (compilation-speed 0)))\n ,(match values\n ((list) `(values))\n ((list x) `(values ,x))\n ;; The strategy here is to use a sorting network if the\n ;; inputs are few, and a stack-allocated vector if the\n ;; inputs are many.\n (otherwise\n (if (<= (length values) 8)\n `(sort-values/network ,gpred ,@values)\n `(sort-values/temp-vector ,gpred ,@values)))))))", "category": "capture-management", "technique": "gensym,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(sctypecase nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by SCTYPECASE", "input": "(sctypecase nil\n (progn))", "output": "(defmacro sctypecase (keyform &body cases)\n \"Like CTYPECASE, except binds the keyform to IT (via SYMBOL-MACROLET) for\nthe scope of the cases. IT can be set with SETF.\"\n `(symbolic ctypecase ,keyform ,@cases))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(letrec* nil)\n\nWhat needs to change: Macro call that should be transformed by LETREC*", "input": "(letrec* nil)", "output": "(defmacro letrec* ((&rest bindings) &body body)\n \"Like LETREC, but the bindings are evaluated in order.\nSee Waddell et al., *Fixing Letrec* for motivation.\n\nCf. `fbindrec*'.\"\n `(letrec-with setq ,bindings\n ,@body))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(prependf 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by PREPENDF", "input": "(prependf 'lol-gen::some-name)", "output": "(defmacro PREPENDF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(collect-alist nil nil)\n\nProblem: Macro call that should be transformed by COLLECT-ALIST", "input": "(collect-alist nil nil)", "output": "(defmacro COLLECT-ALIST ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(econd nil nil)\n\nPattern to recognize: Macro call that should be transformed by ECOND", "input": "(econd nil nil)", "output": "(defmacro econd (&rest clauses)\n \"Like `cond', but signal an error of type `econd-failure' if no\nclause succeeds.\"\n (let ((test-count (length clauses)))\n `(cond ,@clauses\n ;; SBCL will silently eliminate this branch if it is\n ;; unreachable.\n (t (error 'econd-failure :test-count ',test-count)))))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(if-let nil\n nil)\n\nWhat needs to change: Macro call that should be transformed by IF-LET", "input": "(if-let nil\n nil)", "output": "(defmacro if-let (bindings &body (then-form &optional else-form))\n \"Creates new variable bindings, and conditionally executes either\nTHEN-FORM or ELSE-FORM. ELSE-FORM defaults to NIL.\n\nBINDINGS must be either single binding of the form:\n\n (variable initial-form)\n\nor a list of bindings of the form:\n\n ((variable-1 initial-form-1)\n (variable-2 initial-form-2)\n ...\n (variable-n initial-form-n))\n\nAll initial-forms are executed sequentially in the specified order. Then all\nthe variables are bound to the corresponding values.\n\nIf all variables were bound to true values, the THEN-FORM is executed with the\nbindings in effect, otherwise the ELSE-FORM is executed with the bindings in\neffect.\"\n (let* ((binding-list (if (and (consp bindings) (symbolp (car bindings)))\n (list bindings)\n bindings))\n (variables (mapcar #'car binding-list)))\n `(let ,binding-list\n (if (and ,@variables)\n ,then-form\n ,else-form))))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(do+\n nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by DO+", "input": "(do+\n nil\n (progn))", "output": "(defmacro do+ (&body body)\n \"High-level, extensible iteration construct. Refer to the manual for syntax and semantics.\"\n `(do+/internal nil ,@body))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(define-declaration nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by DEFINE-DECLARATION", "input": "(define-declaration nil\n nil)", "output": "(defmacro DEFINE-DECLARATION ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(fm^v 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by FM^V", "input": "(fm^v 'lol-gen::some-name)", "output": "(defmacro fm^v (id)\n `(value (fm^ ,id)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(c_?\n nil\n (progn))\n\nWhat needs to change: Macro call that should be transformed by C_?", "input": "(c_?\n nil\n (progn))", "output": "(defmacro c_? (&body body)\n \"Lazy until asked, then eagerly propagating\"\n `(make-c-dependent\n :code ',body\n :value-state :unevaluated\n :lazy :until-asked\n :rule (c-lambda ,@body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(collect-product 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by COLLECT-PRODUCT", "input": "(collect-product 'lol-gen::some-name)", "output": "(defmacro COLLECT-PRODUCT ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(with-string 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by WITH-STRING", "input": "(with-string 'lol-gen::some-name)", "output": "(defmacro with-string ((var &optional stream\n &key (element-type nil element-type-supplied?))\n &body body)\n \"Bind VAR to the character stream designated by STREAM.\n\nSTREAM is resolved like the DESTINATION argument to `format': it can\nbe any of t (for `*standard-output*'), nil (for a string stream), a\nstring with a fill pointer, or a stream to be used directly.\n\nWhen possible, it is a good idea for functions that build strings to\ntake a stream to write to, so callers can avoid consing a string just\nto write it to a stream. This macro makes it easy to write such\nfunctions.\n\n (defun format-x (x &key stream)\n (with-string (s stream)\n ...))\"\n (declare #+sbcl (sb-ext:muffle-conditions style-warning))\n (when (constantp stream)\n (let ((stream (eval stream)))\n (cond ((eql stream t)\n (return-from with-string\n `(let ((,var *standard-output*))\n ,@body)))\n ((null stream)\n (return-from with-string\n `(with-output-to-string (,var\n ,@(and element-type-supplied?\n `(:element-type ,element-type)))\n ,@body))))))\n\n (with-thunk ((body :name with-string) var)\n `(call/string #',body ,stream)))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.9125}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with-standard-input-syntax\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by WITH-STANDARD-INPUT-SYNTAX", "input": "(with-standard-input-syntax\n nil)", "output": "(defmacro with-standard-input-syntax (&body body)\n \"Like `with-standard-io-syntax', but only bind the variables that\ncontrol the reader, not the printer.\n\nThis may be preferable to using `with-standard-io-syntax' when loading\ndata, as it will not effect how errors are printed, thus preserving\ndebugging information.\"\n (with-thunk ((body :name with-standard-input-syntax))\n `(call/standard-input-syntax ,body)))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(dynamic-let* 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by DYNAMIC-LET*", "input": "(dynamic-let* 'lol-gen::some-name)", "output": "(defmacro DYNAMIC-LET* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(enable-interpol-syntax nil :key nil)\n\nIssue: Macro call that should be transformed by ENABLE-INTERPOL-SYNTAX", "input": "(enable-interpol-syntax nil :key nil)", "output": "(defmacro enable-interpol-syntax (&rest %enable-interpol-syntax-args)\n \"Enable CL-INTERPOL reader syntax.\"\n `(eval-when (:compile-toplevel :load-toplevel :execute)\n (%enable-interpol-syntax ,@%enable-interpol-syntax-args)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(with-connection nil\n (progn))\n\nWhat needs to change: Macro call that should be transformed by WITH-CONNECTION", "input": "(with-connection nil\n (progn))", "output": "(defmacro with-connection (spec &body body)\n \"Evaluates the body with *database* bound to a connection as specified by spec,\nwhich should be list that connect can be applied to.\"\n `(let ((*database* (apply #'connect ,spec)))\n (unwind-protect (progn ,@body)\n (disconnect *database*))))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(define-print-object/std nil)\n\nProblem: Macro call that should be transformed by DEFINE-PRINT-OBJECT/STD", "input": "(define-print-object/std nil)", "output": "(defmacro define-print-object/std (class)\n \"Define a print-object method for objects of class CLASS.\n\n Print all slots with their values. Prints \\\"UNBOUND\\\", as a string, when slots are unbound.\n\n Usage:\n\n (defclass/std test () ((a b)))\n\n (print-object/std test)\n\n The macro expands to:\n\n (DEFMETHOD PRINT-OBJECT ((OBJ TEST) STREAM)\n (PRINT-UNREADABLE-OBJECT (OBJ STREAM :TYPE T :IDENTITY T)\n (FORMAT STREAM \\\"~{~a~^ ~}\\\" (COLLECT-OBJECT-SLOTS OBJ))))\n\"\n `(defmethod print-object ((obj ,class) stream)\n (print-unreadable-object (obj stream :type t :identity t)\n (format stream \"~{~a~^ ~}\"\n (collect-object-slots obj)))))", "category": "dsl", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(character-literal 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by CHARACTER-LITERAL", "input": "(character-literal 'lol-gen::some-name)", "output": "(defmacro CHARACTER-LITERAL ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(bind-custom-vars nil\n :key\n nil)\n\nProblem: Macro call that should be transformed by BIND-CUSTOM-VARS", "input": "(bind-custom-vars nil\n :key\n nil)", "output": "(defmacro bind-custom-vars ((&rest customizations) &body body)\n `(let ,(loop-on-custom (key var value) customizations\n collect (list var value))\n ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(html nil (progn))\n\nIssue: Macro call that should be transformed by HTML", "input": "(html nil (progn))", "output": "(defmacro html (&rest tags)\n `(with-doctype :html\n (tag->string (cons :html ',tags))))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(multiple-value-prog2 nil\n nil)\n\nProblem: Macro call that should be transformed by MULTIPLE-VALUE-PROG2", "input": "(multiple-value-prog2 nil\n nil)", "output": "(defmacro multiple-value-prog2 (first-form second-form &body forms)\n \"Evaluates FIRST-FORM, then SECOND-FORM, and then FORMS. Yields as its value\n all the value returned by SECOND-FORM.\"\n `(progn ,first-form (multiple-value-prog1 ,second-form ,@forms)))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(when-it nil\n (progn))\n\nWhat needs to change: Macro call that should be transformed by WHEN-IT", "input": "(when-it nil\n (progn))", "output": "(defmacro when-it (test &body body)\n \"Like WHEN. IT is bound to TEST.\"\n `(let ((it ,test))\n (when it\n ,@body)))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(print-values\n nil\n (progn))\n\nProblem: Macro call that should be transformed by PRINT-VALUES", "input": "(print-values\n nil\n (progn))", "output": "(defmacro PRINT-VALUES ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(bind 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by BIND", "input": "(bind 'lol-gen::some-name)", "output": "(defmacro bind ((&rest bindings) &body body)\n \"Bind is a replacement for let*, destructuring-bind, multiple-value-bind and more. \n\nAn example is probably the best way to describe its syntax:\n\n \\(bind \\(\\(a 2\\)\n \\(\\(b &rest args &key \\(c 2\\) &allow-other-keys\\) '\\(:a :c 5 :d 10 :e 54\\)\\)\n \\(\\(:values d e\\) \\(truncate 4.5\\)\\)\n \\(\\(:structure xxx- slot1 slot2\\) \\(make-xxx\\)\\)\n \\(\\(:flet name \\(arg1 arg2\\)\\) \\(+ arg1 arg2\\)\\)\\)\n \\(list a b c d e args\\)\\)\n\nSimple bindings are as in let*. Destructuring is done if the first item\nin a binding is a list. Multiple value binding is done if the first item\nin a binding is a list and the first item in the list is ':values'. Other\nforms have their own syntax. For example, :structure first has the conc\nname and then slot names whereas :flet has the function name and a list\nof arguments and then the function body (in an implicit progn).\"\n (let (declarations)\n (loop while (and (consp (car body)) (eq (caar body) 'declare)) do\n (push (first body) declarations)\n (setf body (rest body)))\n (if bindings\n\t(let ((*all-declarations* (bind-expand-declarations (nreverse declarations))))\n\t (prog1\n\t (bind-macro-helper bindings body)\n\t (check-for-unused-variable-declarations *all-declarations*)))\n `(locally\n ,@declarations\n ,@body))))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(with-open-files nil\n :key\n nil)\n\nProblem: Macro call that should be transformed by WITH-OPEN-FILES", "input": "(with-open-files nil\n :key\n nil)", "output": "(defmacro with-open-files ((&rest args) &body body)\n \"A simple macro to open one or more files providing the streams for the BODY. The ARGS is a list of `(stream filespec options*)` as supplied to WITH-OPEN-FILE.\"\n (case (length args)\n ((0)\n `(progn ,@body))\n ((1)\n `(with-open-file ,(first args) ,@body))\n (t `(with-open-file ,(first args)\n (with-open-files\n ,(rest args) ,@body)))))", "category": "dsl", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.8999999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(js-inline)\n\nIssue: Macro call that should be transformed by JS-INLINE", "input": "(js-inline)", "output": "(defmacro JS-INLINE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(as-> nil\n nil)\n\nProblem: Macro call that should be transformed by AS->", "input": "(as-> nil\n nil)", "output": "(defmacro as-> (init var &body exps)\n `(let ((,var ,init))\n ,var\n ,@(loop for (exp next-exp) on exps\n collect (if next-exp `(setf ,var ,exp) exp))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(setf nil (progn))\n\nProblem: Macro call that should be transformed by SETF", "input": "(setf nil (progn))", "output": "(defmacro SETF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(cll-outer 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by CLL-OUTER", "input": "(cll-outer 'lol-gen::some-name)", "output": "(defmacro cll-outer (val &body body)\n `(let ((outer-val ,val))\n ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8374999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(nand nil :key nil)\n\nWrite a macro that addresses: Macro call that should be transformed by NAND", "input": "(nand nil :key nil)", "output": "(defmacro nand (&rest forms)\n \"Equivalent to (not (and ...)).\"\n (if (null forms) nil\n (if (null (rest forms))\n `(not ,(first forms))\n `(if ,(first forms)\n (nand ,@(rest forms))\n t))))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.885}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(list-of 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by LIST-OF", "input": "(list-of 'lol-gen::some-name)", "output": "(defmacro LIST-OF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(update nil)\n\nProblem: Macro call that should be transformed by UPDATE", "input": "(update nil)", "output": "(defmacro update (table &body clauses)\n `(make-statement :update\n ,(expand-expression table) ,@clauses))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(collect-append nil)\n\nIssue: Macro call that should be transformed by COLLECT-APPEND", "input": "(collect-append nil)", "output": "(defmacro COLLECT-APPEND ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(lambda-match1 common-lisp:nil\n (common-lisp:progn))\n\nIssue: Macro call that should be transformed by LAMBDA-MATCH1", "input": "(lambda-match1 common-lisp:nil\n (common-lisp:progn))", "output": "(defmacro lambda-match1 (pattern &body body)\n \"Equivalent to (lambda (arg) (match arg (PATTERN BODY...))).\"\n `(lambda-match (,pattern ,@body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.875}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(if-let nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by IF-LET", "input": "(if-let nil\n :key\n nil)", "output": "(defmacro if-let (bindings &body (then-form &optional else-form))\n \"Creates new variable bindings, and conditionally executes either\nTHEN-FORM or ELSE-FORM. ELSE-FORM defaults to NIL.\n\nBINDINGS must be either single binding of the form:\n\n (variable initial-form)\n\nor a list of bindings of the form:\n\n ((variable-1 initial-form-1)\n (variable-2 initial-form-2)\n ...\n (variable-n initial-form-n))\n\nAll initial-forms are executed sequentially in the specified order. Then all\nthe variables are bound to the corresponding values.\n\nIf all variables were bound to true values, the THEN-FORM is executed with the\nbindings in effect, otherwise the ELSE-FORM is executed with the bindings in\neffect.\"\n (let* ((binding-list (if (and (consp bindings) (symbolp (car bindings)))\n (list bindings)\n bindings))\n (variables (mapcar #'car binding-list)))\n `(let ,binding-list\n (if (and ,@variables)\n ,then-form\n ,else-form))))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(some->\n nil\n :key\n nil)\n\nProblem: Macro call that should be transformed by SOME->", "input": "(some->\n nil\n :key\n nil)", "output": "(defmacro SOME-> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(-<>\n nil\n (progn))\n\nPattern to recognize: Macro call that should be transformed by -<>", "input": "(-<>\n nil\n (progn))", "output": "(defmacro -<> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(coalton-codegen-ast)\n\nPattern to recognize: Macro call that should be transformed by COALTON-CODEGEN-AST", "input": "(coalton-codegen-ast)", "output": "(defmacro COALTON-CODEGEN-AST ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(pprint-coalton-codegen-types\n 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by PPRINT-COALTON-CODEGEN-TYPES", "input": "(pprint-coalton-codegen-types\n 'lol-gen::some-name)", "output": "(defmacro PPRINT-COALTON-CODEGEN-TYPES ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8049999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(whichever nil nil)\n\nWrite a macro that addresses: Macro call that should be transformed by WHICHEVER", "input": "(whichever nil nil)", "output": "(defmacro whichever (&rest possibilities &environment env)\n \"Evaluates exactly one of POSSIBILITIES, chosen at random.\"\n (setf possibilities (mapcar (lambda (p) (macroexpand p env)) possibilities))\n (let ((length (length possibilities)))\n (cond\n ((= 1 length)\n (first possibilities))\n ((every #'constantp possibilities)\n `(svref (load-time-value (vector ,@possibilities)) \n (random ,length)))\n (T\n (labels ((expand (possibilities position random-number)\n (if (null (cdr possibilities))\n (car possibilities)\n (let* ((length (length possibilities))\n (half (truncate length 2))\n (second-half (nthcdr half possibilities))\n (first-half (butlast possibilities (- length half))))\n `(if (< ,random-number ,(+ position half))\n ,(expand first-half position random-number)\n ,(expand second-half (+ position half) random-number))))))\n (with-gensyms (random-number)\n `(let ((,random-number (random ,length)))\n ,(expand possibilities 0 random-number))))))))", "category": "capture-management", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Generate a defmacro form that transforms code like this:\n(m nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by M", "input": "(m nil\n nil)", "output": "(defmacro M ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(for-all* nil\n nil)\n\nIssue: Macro call that should be transformed by FOR-ALL*", "input": "(for-all* nil\n nil)", "output": "(defmacro for-all* (bindings &body body)\n \"Bind BINDINGS to random variables and test BODY *num-trials* times.\n\nWorks like FOR-ALL but variables are defined sequentially - subsequent\ngenerator bindings may use value of a previous generator.\n\nExample:\n\n (for-all* ((a (gen-integer))\n (b (gen-integer :min a :max (+ a 20)))\n (is (<= a b)))\"\n (with-gensyms (test-lambda-args)\n `(perform-random-testing\n nil\n (lambda (,test-lambda-args)\n (declare (ignore ,test-lambda-args))\n (dbind-rec ,bindings\n (if (and ,@(delete-if #'null (mapcar #'third bindings)))\n (progn ,@body)\n (throw 'run-once\n (list :guard-conditions-failed))))))))", "category": "capture-management", "technique": "gensym,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Generate a defmacro form that transforms code like this:\n(with-savepoint nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by WITH-SAVEPOINT", "input": "(with-savepoint nil\n nil)", "output": "(defmacro with-savepoint (name &body body)\n \"Can only be used within a transaction. Establishes a savepoint with the given\nname at the start of body, and binds the same name to a handle for that savepoint.\nThe body is executed and, at the end of body, the savepoint is released, unless a\ncondition is thrown, in which case it is rolled back. Execute the body within a\nsavepoint, releasing savepoint when the body exits normally, and rolling back\notherwise. NAME is both the variable that can be used to release or rolled back\nbefore the body unwinds, and the SQL name of the savepoint.\n\nAn example might look like this:\n\n(defun test12 (x &optional (y nil))\n (with-logical-transaction (lt1 :read-committed-rw)\n (execute (:insert-into 'test-data :set 'value 0))\n (with-savepoint sp1\n (execute (:insert-into 'test-data :set 'value 1))\n (if (< x 0)\n (rollback-savepoint sp1)\n (release-savepoint sp1)))\n (with-savepoint sp2\n (execute (:insert-into 'test-data :set 'value 2))\n (with-savepoint sp3\n (execute (:insert-into 'test-data :set 'value 3))\n (if (> x 0)\n (rollback-savepoint sp3)\n (release-savepoint sp3))\n (when y (rollback-savepoint sp2)))\n (if (= x 0)\n (rollback-savepoint sp2)\n (release-savepoint sp2)))\n (when (string= y \\\"abrt\\\")\n (abort-transaction lt1))))\"\n\n `(call-with-savepoint ',name (lambda (,name)\n (declare (ignorable ,name)) ,@body)))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(c_?dbg\n nil\n nil)\n\nWhat needs to change: Macro call that should be transformed by C_?DBG", "input": "(c_?dbg\n nil\n nil)", "output": "(defmacro c_?dbg (&body body)\n \"Lazy until asked, then eagerly propagating\"\n `(make-c-dependent\n :code ',body\n :value-state :unevaluated\n :lazy :until-asked\n :rule (c-lambda ,@body)\n :debug t))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(collect-last nil (progn))\n\nProblem: Macro call that should be transformed by COLLECT-LAST", "input": "(collect-last nil (progn))", "output": "(defmacro COLLECT-LAST ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(c?+n\n 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by C?+N", "input": "(c?+n\n 'lol-gen::some-name)", "output": "(defmacro c?+n (&body body)\n `(make-c-dependent\n :inputp t\n :code ',body\n :value-state :unevaluated\n :rule (c-lambda ,@body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(lexpr-$send nil :key nil)\n\nIssue: Macro call that should be transformed by LEXPR-$SEND", "input": "(lexpr-$send nil :key nil)", "output": "(defmacro LEXPR-$SEND ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(defmethod nil :key nil)\n\nWhat needs to change: Macro call that should be transformed by DEFMETHOD", "input": "(defmethod nil :key nil)", "output": "(defmacro defmethod (name &rest args)\n (handler-case\n (multiple-value-bind (qualifiers specializers lambda-list body)\n (parse-method args)\n\n (declare (ignore qualifiers))\n\n (with-gensyms (method)\n (let ((fn-name (gentemp (symbol-name (block-name name)) *method-function-package*)))\n `(progn\n ,(make-method-function name fn-name lambda-list body)\n\n (let ((,method\n (walk-environment\n (c2mop:defmethod ,name ,@args))))\n\n (when (combination-options ',name)\n ,(make-add-method-info name method fn-name body)\n ,(make-static-dispatch name lambda-list specializers))\n\n ,method)))))\n\n (error (e)\n (simple-style-warning \"Error parsing DEFMETHOD form:~%~2T~a\" e)\n `(walk-environment\n (c2mop:defmethod ,name ,@args)))))", "category": "capture-management", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(destructuring-bind () nil)\n\nIssue: Macro call that should be transformed by DESTRUCTURING-BIND", "input": "(destructuring-bind () nil)", "output": "(defmacro DESTRUCTURING-BIND ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(builder 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by BUILDER", "input": "(builder 'lol-gen::some-name)", "output": "(defmacro builder (&rest app-or-middlewares)\n (let ((middlewares (butlast app-or-middlewares)))\n `(reduce #'funcall\n (remove-if\n #'null\n (list\n ,@(loop for mw in middlewares\n when mw\n collect (convert-to-middleware-form mw))))\n :initial-value (to-app ,(car (last app-or-middlewares)))\n :from-end t)))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(appendf 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by APPENDF", "input": "(appendf 'lol-gen::some-name)", "output": "(defmacro APPENDF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(when-match common-lisp:nil\n :key\n common-lisp:nil)\n\nPattern to recognize: Macro call that should be transformed by WHEN-MATCH", "input": "(when-match common-lisp:nil\n :key\n common-lisp:nil)", "output": "(defmacro when-match (pattern arg &body body)\n \"Equivalent to (match ARG (PATTERN BODY...)).\"\n `(match ,arg (,pattern ,.body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.875}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(insert-into nil\n (progn))\n\nIssue: Macro call that should be transformed by INSERT-INTO", "input": "(insert-into nil\n (progn))", "output": "(defmacro insert-into (table &body clauses)\n `(make-statement :insert-into\n ,(expand-expression table)\n ,@(if (and (listp (car clauses))\n (keywordp (caar clauses)))\n `(',(car clauses) ,@(cdr clauses))\n clauses)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(finish nil)\n\nPattern to recognize: Macro call that should be transformed by FINISH", "input": "(finish nil)", "output": "(defmacro finish (form &optional description &rest format-args)\n `(eval-in-context\n *context*\n (make-instance 'finishing-result\n :expression '(finish ,form)\n :body (lambda () ,form)\n ,@(when description\n `(:description (format NIL ,description ,@format-args))))))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.885}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(maybe-once-only nil)\n\nWrite a macro that addresses: Macro call that should be transformed by MAYBE-ONCE-ONLY", "input": "(maybe-once-only nil)", "output": "(defmacro MAYBE-ONCE-ONLY ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(walk-environment\n 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by WALK-ENVIRONMENT", "input": "(walk-environment\n 'lol-gen::some-name)", "output": "(defmacro WALK-ENVIRONMENT ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-transaction nil\n nil)\n\nIssue: Macro call that should be transformed by WITH-TRANSACTION", "input": "(with-transaction nil\n nil)", "output": "(defmacro with-transaction ((&optional name isolation-level) &body body)\n \"Execute the given body within a database transaction, committing it when the\nbody exits normally, and aborting otherwise. An optional name and/or\nisolation-level can be given to the transaction. The name can be used to force\na commit or abort before the body unwinds. The isolation-level will set the\nisolation-level used by the transaction.\n\nYou can specify the following isolation levels in postmodern transactions:\n\n- :read-committed-rw (read committed with read and write)\n- :read-committed-ro (read committed with read only)\n- :repeatable-read-rw (repeatable read with read and write)\n- :repeatable-read-ro (repeatable read with read only)\n- :serializable (serializable with reand and write)\n\nSample usage where george is just the name given to the transaction (not quoted\nor a string) and ... simply indicates other statements would be expected here:\n\n (with-transaction ()\n (execute (:insert-into 'test-data :set 'value 77))\n ...)\n\n (with-transaction (george)\n (execute (:insert-into 'test-data :set 'value 22))\n ...)\n\n (with-transaction (george :read-committed-rw)\n (execute (:insert-into 'test-data :set 'value 33))\n (query (:select '* :from 'test-data))\n ...)\n\n (with-transaction (:serializable)\n (execute (:insert-into 'test-data :set 'value 44))\n ...)\n\nFurther discussion of transactions and isolation levels can found in the\nisolation notes file in the doc folder.\"\n (let ((transaction-name (or (when (not (isolation-level-p name))\n name)\n (gensym \"anonymous-transaction\"))))\n (when (and name (isolation-level-p name))\n (setf isolation-level name))\n `(call-with-transaction (lambda (,transaction-name)\n (declare (ignorable ,transaction-name)) ,@body)\n ,isolation-level)))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.835}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(f-zerop nil :key nil)\n\nProblem: Macro call that should be transformed by F-ZEROP", "input": "(f-zerop nil :key nil)", "output": "(defmacro f-zerop (key &rest body)\n `(with-synapse ,key (prior-fire-value) \n (let ((new-basis (progn ,@body)))\n (values new-basis (if (xor prior-fire-value (zerop new-basis))\n (progn\n (setf prior-fire-value (zerop new-basis))\n :propagate)\n :no-propagate)))))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(sum-of nil\n :key\n nil)\n\nIssue: Macro call that should be transformed by SUM-OF", "input": "(sum-of nil\n :key\n nil)", "output": "(defmacro SUM-OF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(defpackage nil)\n\nProblem: Macro call that should be transformed by DEFPACKAGE", "input": "(defpackage nil)", "output": "(defmacro DEFPACKAGE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(do-for nil)\n\nWhat needs to change: Macro call that should be transformed by DO-FOR", "input": "(do-for nil)", "output": "(defmacro DO-FOR ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(js 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by JS", "input": "(js 'lol-gen::some-name)", "output": "(defmacro JS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(all-of nil\n (progn))\n\nProblem: Macro call that should be transformed by ALL-OF", "input": "(all-of nil\n (progn))", "output": "(defmacro ALL-OF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(the 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by THE", "input": "(the 'lol-gen::some-name)", "output": "(defmacro THE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(once-only nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by ONCE-ONLY", "input": "(once-only nil\n nil)", "output": "(defmacro once-only (specs &body forms)\n \"Constructs code whose primary goal is to help automate the handling of\nmultiple evaluation within macros. Multiple evaluation is handled by introducing\nintermediate variables, in order to reuse the result of an expression.\n\nThe returned value is a list of the form\n\n (let ((<gensym-1> <expr-1>)\n ...\n (<gensym-n> <expr-n>))\n <res>)\n\nwhere GENSYM-1, ..., GENSYM-N are the intermediate variables introduced in order\nto evaluate EXPR-1, ..., EXPR-N once, only. RES is code that is the result of\nevaluating the implicit progn FORMS within a special context determined by\nSPECS. RES should make use of (reference) the intermediate variables.\n\nEach element within SPECS is either a symbol SYMBOL or a pair (SYMBOL INITFORM).\nBare symbols are equivalent to the pair (SYMBOL SYMBOL).\n\nEach pair (SYMBOL INITFORM) specifies a single intermediate variable:\n\n- INITFORM is an expression evaluated to produce EXPR-i\n\n- SYMBOL is the name of the variable that will be bound around FORMS to the\n corresponding gensym GENSYM-i, in order for FORMS to generate RES that\n references the intermediate variable\n\nThe evaluation of INITFORMs and binding of SYMBOLs resembles LET. INITFORMs of\nall the pairs are evaluated before binding SYMBOLs and evaluating FORMS.\n\nExample:\n\n The following expression\n\n (let ((x '(incf y)))\n (once-only (x)\n `(cons ,x ,x)))\n\n ;;; =>\n ;;; (let ((#1=#:X123 (incf y)))\n ;;; (cons #1# #1#))\n\n could be used within a macro to avoid multiple evaluation like so\n\n (defmacro cons1 (x)\n (once-only (x)\n `(cons ,x ,x)))\n\n (let ((y 0))\n (cons1 (incf y)))\n\n ;;; => (1 . 1)\n\nExample:\n\n The following expression demonstrates the usage of the INITFORM field\n\n (let ((expr '(incf y)))\n (once-only ((var `(1+ ,expr)))\n `(list ',expr ,var ,var)))\n\n ;;; =>\n ;;; (let ((#1=#:VAR123 (1+ (incf y))))\n ;;; (list '(incf y) #1# #1))\n\n which could be used like so\n\n (defmacro print-succ-twice (expr)\n (once-only ((var `(1+ ,expr)))\n `(format t \\\"Expr: ~s, Once: ~s, Twice: ~s~%\\\" ',expr ,var ,var)))\n\n (let ((y 10))\n (print-succ-twice (incf y)))\n\n ;;; >>\n ;;; Expr: (INCF Y), Once: 12, Twice: 12\"\n (let ((gensyms (make-gensym-list (length specs) \"ONCE-ONLY\"))\n (names-and-forms (mapcar (lambda (spec)\n (etypecase spec\n (list\n (destructuring-bind (name form) spec\n (cons name form)))\n (symbol\n (cons spec spec))))\n specs)))\n ;; bind in user-macro\n `(let ,(mapcar (lambda (g n) (list g `(gensym ,(string (car n)))))\n gensyms names-and-forms)\n ;; bind in final expansion\n `(let (,,@(mapcar (lambda (g n)\n ``(,,g ,,(cdr n)))\n gensyms names-and-forms))\n ;; bind in user-macro\n ,(let ,(mapcar (lambda (n g) (list (car n) g))\n names-and-forms gensyms)\n ,@forms)))))", "category": "control-flow", "technique": "once-only,gensym,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(aand nil :key nil)\n\nIssue: Macro call that should be transformed by AAND", "input": "(aand nil :key nil)", "output": "(defmacro aand (first &rest rest)\n \"Like AND, except binds the first argument to IT (via LET) for the\nscope of the rest of the arguments.\"\n `(anaphoric and ,first ,@rest))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-ps-gensyms nil)\n\nIssue: Macro call that should be transformed by WITH-PS-GENSYMS", "input": "(with-ps-gensyms nil)", "output": "(defmacro WITH-PS-GENSYMS ...)", "category": "control-flow", "technique": "gensym", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "Generate a defmacro form that transforms code like this:\n(export-structure\n common-lisp:nil\n common-lisp:nil)\n\nPattern to recognize: Macro call that should be transformed by EXPORT-STRUCTURE", "input": "(export-structure\n common-lisp:nil\n common-lisp:nil)", "output": "(defmacro EXPORT-STRUCTURE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8049999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(with-stemcell-infer-hook nil)\n\nProblem: Macro call that should be transformed by WITH-STEMCELL-INFER-HOOK", "input": "(with-stemcell-infer-hook nil)", "output": "(defmacro with-stemcell-infer-hook (func &body body)\n (let ((func-name (gensym \"hook\")))\n `(let* ((,func-name ,func)\n (*stemcell-infer-hook* ,func-name))\n ,@body)))", "category": "dsl", "technique": "gensym", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(fm-otherv? nil nil)\n\nWrite a macro that addresses: Macro call that should be transformed by FM-OTHERV?", "input": "(fm-otherv? nil nil)", "output": "(defmacro fm-otherv? (md-name &optional (starting 'self) (global-search t))\n `(fm-other-v ,md-name ,starting ,global-search))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(~> 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by ~>", "input": "(~> 'lol-gen::some-name)", "output": "(defmacro ~> (needle &rest holes)\n \"Threading macro from Clojure (by way of Racket).\n\nThread NEEDLE through HOLES, where each hole is either a\nsymbol (equivalent to `(hole needle)`) or a list (equivalent to `(hole\nneedle args...)`).\n\nAs an extension, an underscore in the argument list is replaced with\nthe needle, so you can pass the needle as an argument other than the\nfirst.\"\n (thread-aux '~> needle holes\n (lambda (needle hole)\n (list* (car hole) needle (cdr hole)))))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(example\n nil\n :key\n nil)\n\nIssue: Macro call that should be transformed by EXAMPLE", "input": "(example\n nil\n :key\n nil)", "output": "(defmacro example (&body body)\n \"Like `comment'.\"\n `(comment ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Generate a defmacro form that transforms code like this:\n(declaim nil\n (progn))\n\nPattern to recognize: Macro call that should be transformed by DECLAIM", "input": "(declaim nil\n (progn))", "output": "(defmacro DECLAIM ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-contracts-disabled nil\n (progn))\n\nIssue: Macro call that should be transformed by WITH-CONTRACTS-DISABLED", "input": "(with-contracts-disabled nil\n (progn))", "output": "(defmacro with-contracts-disabled (() &body body)\n \"A shorthand for disabling all contracts for the extent of this form.\"\n (let ((enabled-contracts (gensym \"ENABLED-CONTRACTS-\")))\n `(let ((,enabled-contracts (enabled-contracts)))\n (unwind-protect\n (progn (disable-contracts)\n ,@body)\n (apply #'enable-contracts ,enabled-contracts)))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "basic", "quality_score": 0.7999999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(with-packages-unlocked nil\n nil)\n\nWhat needs to change: Macro call that should be transformed by WITH-PACKAGES-UNLOCKED", "input": "(with-packages-unlocked nil\n nil)", "output": "(defmacro WITH-PACKAGES-UNLOCKED ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(summing\n nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by SUMMING", "input": "(summing\n nil\n nil)", "output": "(defmacro summing (&body body)\n \"Within BODY, bind `sum' to a function that gathers numbers to sum.\n\nIf the first form in BODY is a literal number, it is used instead of 0\nas the initial sum.\n\nTo see the running sum, call `sum' with no arguments.\n\nReturn the total.\"\n ;; TODO This should be numerically stable, at least if the zero is a\n ;; float.\n (let ((zero (if (numberp (first body)) (pop body) 0)))\n (with-gensyms (running-total x x-supplied?)\n (with-current-package-symbols (sum)\n `(let ((,running-total ,zero))\n (declare (number ,running-total))\n (flet ((,sum (&optional (,x 0 ,x-supplied?))\n (if ,x-supplied?\n (incf ,running-total ,x)\n ,running-total)))\n (declare (ignorable (function ,sum)))\n ,@body)\n (the number ,running-total))))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "intermediate", "quality_score": 0.7975}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-slots nil\n (progn))\n\nIssue: Macro call that should be transformed by WITH-SLOTS", "input": "(with-slots nil\n (progn))", "output": "(defmacro WITH-SLOTS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(aetypecase nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by AETYPECASE", "input": "(aetypecase nil\n nil)", "output": "(defmacro aetypecase (keyform &body cases)\n \"Like ETYPECASE, except binds the result of the keyform to IT (via LET) for\nthe scope of the cases.\"\n `(anaphoric etypecase ,keyform ,@cases))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(is-type nil :key nil)\n\nWrite a macro that addresses: Macro call that should be transformed by IS-TYPE", "input": "(is-type nil :key nil)", "output": "(defmacro is-type (got expected-type &optional desc)\n (with-gensyms (duration result)\n (once-only (desc expected-type)\n `(with-catching-errors (:description ,desc :expected ,expected-type)\n (with-duration ((,duration ,result) ,got)\n (test ,result ,expected-type ,desc\n :duration ,duration\n :got-form ',got\n :test-fn #'typep\n :report-expected-label \"be a type of\"))))))", "category": "capture-management", "technique": "once-only,gensym", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(iter)\n\nProblem: Macro call that should be transformed by ITER", "input": "(iter)", "output": "(defmacro ITER ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(quasiquote nil)\n\nIssue: Macro call that should be transformed by QUASIQUOTE", "input": "(quasiquote nil)", "output": "(defmacro quasiquote (x) (quasiquote-expand x))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "basic", "quality_score": 0.7075}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(having nil)\n\nProblem: Macro call that should be transformed by HAVING", "input": "(having nil)", "output": "(defmacro having (expression)\n `(make-clause :having\n ,(if (and (listp expression)\n (keywordp (car expression)))\n (expand-op expression)\n `,expression)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(lambda-cmatch*\n common-lisp:nil\n :key\n common-lisp:nil)\n\nWhat needs to change: Macro call that should be transformed by LAMBDA-CMATCH*", "input": "(lambda-cmatch*\n common-lisp:nil\n :key\n common-lisp:nil)", "output": "(defmacro lambda-cmatch* (&body body)\n \"Equivalent to (lambda (args...) (cmatch* (args...) BODY...)).\"\n (multiple-value-bind (preamble clauses) (parse-matcher-body body)\n (let ((gensyms (make-gensyms (caar clauses))))\n `(lambda ,gensyms\n ,@preamble\n (cmatch* ,gensyms\n ,@clauses)))))", "category": "control-flow", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.9125}
{"instruction": "Generate a defmacro form that transforms code like this:\n(match-of nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by MATCH-OF", "input": "(match-of nil\n nil)", "output": "(defmacro match-of (union expr &body clauses &environment env)\n \"Do pattern matching on an algebraic data type.\n\nUNION should be an algebraic data type.\n\nEach clause in CLAUSES has a pattern as its first element.\n\nIf the pattern is a symbol, it matches a unit type.\n\nIf the pattern is a list, it matches a constructor.\n\nIf the pattern is an underscore, it introduces a default or\nfallthrough clause.\n\nIf the pattern is a list that starts with `or', it is a disjunction of\nother patterns.\"\n (check-match-exhaustive union clauses env)\n `(ematch ,expr\n ,@(loop for (pattern . body) in clauses\n collect `(,(nth-value 1 (pattern-type pattern union))\n ,@body))))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(eif nil :key nil)\n\nWhat needs to change: Macro call that should be transformed by EIF", "input": "(eif nil :key nil)", "output": "(defmacro eif (&whole whole test then &optional (else nil else?))\n \"Like `cl:if', but expects two branches.\n\nIf there is only one branch a warning is signaled.\n\nThis macro is useful when writing explicit decision trees; it will\nwarn you if you forget a branch.\n\nShort for \u201cexhaustive if\u201d.\"\n (unless else?\n (warn \"Missing else-branch in eif form:~%~a\"\n whole))\n `(if ,test ,then ,else))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Generate a defmacro form that transforms code like this:\n(finalize-dispatch-method nil nil)\n\nPattern to recognize: Macro call that should be transformed by FINALIZE-DISPATCH-METHOD", "input": "(finalize-dispatch-method nil nil)", "output": "(defmacro finalize-dispatch-method (generic-function &rest args)\n \"add a body to the method which dispatched the hooks for the given specialized-lambda-list\nuseful if you wanted to use call-next-method\n\nFor the definition to be effective, it must be defined after every specific hook for the same method hence finalize.\n\nSee defhook\"\n (%destructure-defhook-args args\n (with-effective-qualifier generic-function qualifier\n (destructure-specialized-lambda-list descriptive-lambda-list vanilla-lambda-list type-list specialized-lambda-list\n `(%lay-method-base-for-dispatch ,generic-function ,qualifier ,type-list ,descriptive-lambda-list\n ,@body)))))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Generate a defmacro form that transforms code like this:\n(fm-other? nil)\n\nPattern to recognize: Macro call that should be transformed by FM-OTHER?", "input": "(fm-other? nil)", "output": "(defmacro fm-other? (md-name &optional (starting 'self) (global-search t))\n `(fm-find-one ,starting ,(if (consp md-name)\n `(list ',(car md-name) ,(cadr md-name))\n `',md-name)\n :must-find nil\n :global-search ,global-search))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(assert! nil)\n\nWrite a macro that addresses: Macro call that should be transformed by ASSERT!", "input": "(assert! nil)", "output": "(defmacro ASSERT! ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(annotation nil nil)\n\nPattern to recognize: Macro call that should be transformed by ANNOTATION", "input": "(annotation nil nil)", "output": "(defmacro ANNOTATION ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(number-literal nil)\n\nWrite a macro that addresses: Macro call that should be transformed by NUMBER-LITERAL", "input": "(number-literal nil)", "output": "(defmacro NUMBER-LITERAL ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(defsyntax nil\n nil)\n\nProblem: Macro call that should be transformed by DEFSYNTAX", "input": "(defsyntax nil\n nil)", "output": "(defmacro defsyntax (name &body options)\n `(progn\n (setf (get ',name :options) ',options)\n (defvar ,name (defreadtable ,name ,@options))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(define-symbol-macro nil (progn))\n\nWhat needs to change: Macro call that should be transformed by DEFINE-SYMBOL-MACRO", "input": "(define-symbol-macro nil (progn))", "output": "(defmacro DEFINE-SYMBOL-MACRO ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(prependf nil)\n\nProblem: Macro call that should be transformed by PREPENDF", "input": "(prependf nil)", "output": "(defmacro PREPENDF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(jwhen 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by JWHEN", "input": "(jwhen 'lol-gen::some-name)", "output": "(defmacro jwhen (test &body body)\n \"JSON-aware version of `cl:when'.\nIf TEST is `jtruep' evaluate BODY.\"\n `(jif ,test\n (progn ,@body)))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(and 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by AND", "input": "(and 'lol-gen::some-name)", "output": "(defmacro AND ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(boolean-when 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by BOOLEAN-WHEN", "input": "(boolean-when 'lol-gen::some-name)", "output": "(defmacro boolean-when (branch &body body &environment env)\n \"Includes some forms based on whether a macroexpand-time branch is true. The\nfirst argument must be a symbol naming a branch in the lexically enclosing\nWITH-BOOLEAN form.\n\\\nIt is an error to use this macro outside the lexical environment established by\nWITH-BOOLEAN.\"\n (cond (*boolean-bypass*\n `(when ,branch ,@body))\n ((not (member branch (macroexpand-1 '%all-branches% env)))\n (missing-branch branch))\n ((not (macroexpand-1 '%in-branching% env))\n (conditional-error 'when))\n ((not (member branch (macroexpand-1 '%true-branches% env)))\n `(progn))\n ((= 0 (length body))\n `(progn))\n ((= 1 (length body))\n (car body))\n (t `(progn ,@body))))", "category": "anaphoric", "technique": "nested-backquote,anaphor", "complexity": "advanced", "quality_score": 0.8999999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(c_in\n nil\n :key\n nil)\n\nIssue: Macro call that should be transformed by C_IN", "input": "(c_in\n nil\n :key\n nil)", "output": "(defmacro c_in (&body body)\n `(c-input (:lazy :once-asked) (progn ,@body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(trc 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by TRC", "input": "(trc 'lol-gen::some-name)", "output": "(defmacro trc (tgt-form &rest os)\n (if (eql tgt-form 'nil)\n '(progn)\n (if (stringp tgt-form)\n `(without-c-dependency\n (call-trc t ,tgt-form ,@os))\n (let ((tgt (gensym)))\n ;(break \"slowww? ~a\" tgt-form)\n `(without-c-dependency\n (bif (,tgt ,tgt-form)\n (if (trcp ,tgt)\n (progn\n (assert (stringp ,(car os)) () \"trc with test expected string second, got ~a\" ,(car os))\n (call-trc t ,@os)) ;;,(car os) ,tgt ,@(cdr os)))\n (progn\n ;(trc \"trcfailed\")\n (count-it :trcfailed)))\n (count-it :tgtnileval)))))))", "category": "control-flow", "technique": "gensym,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(op\n 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by OP", "input": "(op\n 'lol-gen::some-name)", "output": "(defmacro op (&body body &environment env)\n \"GOO's simple macro for positional lambdas.\n\nAn OP is like a lambda without an argument list. Within the body of the OP\nform, an underscore introduces a new argument.\n\n (reduce (op (set-intersection _ _ :test #'equal))\n sets)\n\nYou can refer back to each argument by number, starting with _1.\n\n (funcall (op (+ _ _1)) 2) => 4\n\nYou can also use positional arguments directly:\n\n (reduce (op (funcall _2 _1)) ...)\n\nArgument lists can be sparse:\n\n (apply (op (+ _1 _3 _5)) '(1 2 3 4 5)) => 9\n\nNote that OP with a single argument is equivalent to CONSTANTLY:\n\n (funcall (op 1)) => 1\n\nand that OP with a single placeholder is equivalent to IDENTITY:\n\n (funcall (op _) 1) => 1\n\nOP can also be used to define variadic functions by using _* as the\nplaceholder. It is not necessary to use APPLY.\n\n (apply (op (+ _*)) '(1 2 3 4)) => 10\n\nOP is intended for simple functions -- one-liners. Parameters are\nextracted according to a depth-first walk of BODY. Macro expansion\nmay, or may not, be done depending on the implementation; it should\nnot be relied on. Lexical bindings may, or may not, shadow\nplaceholders -- again, it depends on the implementation. (This means,\namong other things, that nested use of `op' is not a good idea.)\nBecause of the impossibility of a truly portable code walker, `op'\nwill never be a true replacement for `lambda'. But even if it were\npossible to do better, `op' would still only be suited for one-liners.\nIf you need more than a one-liner, then you should be giving your\nparameters names.\n\n\\(One thing you *can* count on is the ability to use `op' with\nquasiquotes. If using placeholders inside quasiquotes does not work on\nyour Lisp implementation, that's a bug, not a limitation.)\"\n (let ((env (extract-op-env body env)))\n (op-env-lambda env)))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(is-values nil :key nil)\n\nIssue: Macro call that should be transformed by IS-VALUES", "input": "(is-values nil :key nil)", "output": "(defmacro is-values (got expected &rest args)\n `(is (multiple-value-list ,got) ,expected ,@args))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(psetq)\n\nIssue: Macro call that should be transformed by PSETQ", "input": "(psetq)", "output": "(defmacro PSETQ ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-simple-restart 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by WITH-SIMPLE-RESTART", "input": "(with-simple-restart 'lol-gen::some-name)", "output": "(defmacro WITH-SIMPLE-RESTART ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(make-instance* 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by MAKE-INSTANCE*", "input": "(make-instance* 'lol-gen::some-name)", "output": "(defmacro make-instance* (class &rest arguments)\n \"Convenience macro on top of `make-instance'.\n\nConveniences:\n\n- First argument can be a (possibly empty) list of shortcut symbols,\n which is automatically converted into a KEYWORD+SYMBOL pairs where\n - KEYWORD is the same as shortcut name, but interned as keyword.\n - And SYMBOL is the same as shortcut.\n\n- The last argument can be an apply argument---arbitrary\n list-producing form, which will be used as the last argument\n to (apply #'make-instance ...) idiom.\n\nNote that using a singular shortcut list of apply argument is an\nambiguous case that will be interpreted in favor of apply argument. To\nforce either of interpretations, provide shortcuts and apply arguments\nexplicitly:\n(make-instance* 'class (a b c)) ;; BAD\n(make-instance* 'class (a b c) nil) ;; GOOD\n(make-instance* 'class (when t nil)) ;; BAD\n(make-instance* 'class () (when t nil)) ;; GOOD\n\nOtherwise, the behavior is equivalent to `make-instance'.\n\nExamples:\n\nShortcut args:\n\\(make-instance* 'class (a b c))\n=>\n\\(make-instance 'class :a a :b b :c c)\n\nLast form converted into `apply' argument:\n\\(make-instance* 'class :c c :b b (when something (list :a a)))\n=>\n\\(apply #'make-instance 'class :c c :b b (when something (list :a a)))\n\nShortcut arguments, regular arguments, and form for `apply':\n\\(make-instance* 'class (b c) :x x (when something (list :a a)))\n=>\n\\(apply #'make-instance 'class :b b :c c :x x (when something (list :a a)))\n\nForm for `apply' (notice the empty shortcuts---these are required for\nunambiguous parsing):\n\\(make-instance* 'class () (when something (list :a a)))\n=>\n\\(apply #'make-instance 'class (when something (list :a a)))\n\nRegular `make-instance'-like use:\n\\(make-instance* 'class :a a-value :b b-value)\n=>\n\\(make-instance 'class :a a-value :b b-value)\"\n (when (and (= 1 (length arguments))\n (listp (first arguments)))\n (style-warn \"Body of MAKE-INSTANCE* contains a single list-like form ~a.\n\nIf you meant APPLY args, add empty shortcuts list:\n(make-instance* 'class () (apply-form))\n\nIf you meant shortcut list, add empty APPLY args:\n(make-instance* 'class (shortcuts) nil)\n\nInterpreting as APPLY args for now, but this behavior may change in\nthe future.\" arguments))\n (let* ((shortcuts-p (and (listp (first arguments))\n (> (length arguments) 1)))\n (shortcuts (when shortcuts-p\n (first arguments)))\n (arguments (if shortcuts-p\n (rest arguments)\n arguments))\n (last-appendable-form-p (oddp (length arguments)))\n (last-appendable-form (when last-appendable-form-p\n (first (last arguments))))\n (arguments (if last-appendable-form-p\n (butlast arguments)\n arguments)))\n `(,@(if last-appendable-form-p\n `(apply #'make-instance)\n `(make-instance))\n ,class\n ,@(loop for shortcut in shortcuts\n append (list (intern (symbol-name shortcut) :keyword)\n shortcut))\n ,@arguments\n ,@(when last-appendable-form-p\n (list last-appendable-form)))))", "category": "anaphoric", "technique": "nested-backquote,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.9249999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-walker-handler-lexical-environment)\n\nIssue: Macro call that should be transformed by WITH-WALKER-HANDLER-LEXICAL-ENVIRONMENT", "input": "(with-walker-handler-lexical-environment)", "output": "(defmacro WITH-WALKER-HANDLER-LEXICAL-ENVIRONMENT ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(make-list common-lisp:nil common-lisp:nil)\n\nWrite a macro that addresses: Macro call that should be transformed by MAKE-LIST", "input": "(make-list common-lisp:nil common-lisp:nil)", "output": "(defmacro make-list (cl:&rest forms)\n \"Create a heterogeneous Coalton `List` of objects. This macro is\ndeprecated; use `coalton/list:make`.\"\n (cl:labels\n ((list-helper (forms)\n (cl:if (cl:endp forms)\n `coalton:Nil\n `(coalton:Cons ,(cl:car forms) ,(list-helper (cl:cdr forms))))))\n (list-helper forms)))", "category": "control-flow", "technique": "nested-backquote", "complexity": "advanced", "quality_score": 0.8999999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(pccase nil (progn))\n\nIssue: Macro call that should be transformed by PCCASE", "input": "(pccase nil (progn))", "output": "(defmacro pccase (pred keyform &rest clauses)\n \"Like CCASE, but uses given PRED instead of EQL to select appropriate CLAUSE.\n\n Example usage:\n\n CL-USER> (pccase '< 1\n (0 (print \\\"Below zero\\\"))\n (2 (print \\\"OK\\\")))\n\"\n (expand-predicate-case pred keyform clauses 'ccase))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.885}
{"instruction": "Generate a defmacro form that transforms code like this:\n(dreletf nil\n (progn))\n\nPattern to recognize: Macro call that should be transformed by DRELETF", "input": "(dreletf nil\n (progn))", "output": "(defmacro DRELETF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(pop-assoc nil nil)\n\nWhat needs to change: Macro call that should be transformed by POP-ASSOC", "input": "(pop-assoc nil nil)", "output": "(defmacro pop-assoc (key alist &rest args &environment env)\n \"Like `assoc' but, if there was a match, delete it from ALIST.\n\nFrom Newlisp.\"\n (multiple-value-bind (vars vals new setter getter)\n (get-setf-expansion alist env)\n (with-gensyms (match)\n `(let* (,@(mapcar #'list vars vals)\n (,(car new) ,getter))\n (let ((,match (assoc ,key ,(car new) ,@args)))\n (declare (list ,match))\n (prog1 ,match\n (when ,match\n (setf ,(car new) (efface ,match ,(car new))))\n ,setter))))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "intermediate", "quality_score": 0.7975}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(dynamic-wind\n nil)\n\nWhat needs to change: Macro call that should be transformed by DYNAMIC-WIND", "input": "(dynamic-wind\n nil)", "output": "(defmacro DYNAMIC-WIND ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(c?? nil)\n\nPattern to recognize: Macro call that should be transformed by C??", "input": "(c?? nil)", "output": "(defmacro c?? ((&key (tagp nil) (in nil) (out t))&body body)\n (let ((result (copy-symbol 'result))\n (thetag (gensym)))\n `(make-c-dependent\n :code ',body\n :value-state :unevaluated\n :rule (c-lambda\n (let ((,thetag (gensym \"tag\"))\n (*trcdepth* (1+ *trcdepth*))\n )\n (declare (ignorable self ,thetag))\n ,(when in\n `(trc \"c??> entry\" (c-slot-name c) (c-model c) (when ,tagp ,thetag)))\n (count-it :c?? (c-slot-name c) (md-name (c-model c)))\n (let ((,result (progn ,@body)))\n ,(when out `(trc \"c?? result:\" ,result (c-slot-name c) (when ,tagp ,thetag)))\n ,result))))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "intermediate", "quality_score": 0.7975}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(alter nil nil)\n\nWrite a macro that addresses: Macro call that should be transformed by ALTER", "input": "(alter nil nil)", "output": "(defmacro ALTER ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(select-dao nil nil)\n\nPattern to recognize: Macro call that should be transformed by SELECT-DAO", "input": "(select-dao nil nil)", "output": "(defmacro select-dao (type &optional (test t) &rest ordering)\n \"Select DAO objects for the rows in the associated table for which the given\ntest (either an S-SQL expression or a string) holds. When sorting arguments\nare given, which can also be S-SQL forms or strings, these are used to sort\nthe result.\n\n(Note that, if you want to sort, you have to pass the test argument.)\n\n (select-dao 'user (:> 'score 10000) 'name)\"\n\n `(query-dao% ,type (sql ,(generate-dao-query type test ordering))\n (dao-row-reader (find-class ,type))))", "category": "efficiency", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.885}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(group-by)\n\nWhat needs to change: Macro call that should be transformed by GROUP-BY", "input": "(group-by)", "output": "(defmacro group-by (&rest expressions)\n `(apply #'make-clause :group-by ',expressions))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(vref nil nil)\n\nWrite a macro that addresses: Macro call that should be transformed by VREF", "input": "(vref nil nil)", "output": "(defmacro vref (vec index &environment env)\n \"When used globally, same as `aref'.\n\nInside of a with-type-dispatch form, calls to `vref' may be bound to\ndifferent accessors, such as `char' or `schar', or `bit' or `sbit',\ndepending on the type being specialized on.\"\n (if (symbolp vec)\n (let* ((type (variable-type vec env))\n (vref (type-vref type)))\n `(,vref ,vec ,index))\n `(aref ,vec ,index)))", "category": "dsl", "technique": "recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(named-lambda nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by NAMED-LAMBDA", "input": "(named-lambda nil\n nil)", "output": "(defmacro named-lambda (name lambda-list &body body)\n \"Expands into a lambda-expression within whose BODY NAME denotes the\n corresponding function.\"\n `(labels ((,name ,lambda-list ,@body))\n #',name))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with-c-syntax common-lisp:nil\n common-lisp:nil)\n\nWrite a macro that addresses: Macro call that should be transformed by WITH-C-SYNTAX", "input": "(with-c-syntax common-lisp:nil\n common-lisp:nil)", "output": "(defmacro with-c-syntax ((&rest options\n\t\t\t &key (preprocess t)\n (reader-level *with-c-syntax-reader-level*)\n (readtable-case (or *with-c-syntax-reader-case*\n (readtable-case *readtable*)))\n (input-file-pathname nil)\n\t\t\t (try-add-{} t))\n\t\t\t &environment *wcs-expanding-environment*\n\t\t\t &body body)\n \"This macro is a entry point of the with-c-syntax system. BODY will be\ninterpreted as C syntax, executed, and return values.\n\nThis macro returns the last form's value if BODY is a compound\nstatement, or returns NIL if BODY is a compilation unit.\n\nPREPROCESS specifies how to do preprocess. If nil, this macro compiles\nBODY without preprocessing. If t, preprocesses and compiles BODY. If\n`:preprocess-only', this macro preprocesses BODY and returns the\nresult as-is.\n\nREADER-LEVEL specifies the reader level (see `*with-c-syntax-reader-level*').\nThis is used when '#include' or '_Pragma()' was used.\n\nREADTABLE-CASE specifies the readtable case of symbols in BODY when it\nwas read. This affects how to intern C keywords by the preprocessor.\n\nINPUT-FILE-PATHNAME is passed to the preprocessor and used when\n'__FILE__' macro was used.\n\nIf TRY-ADD-{} is t and an error occurred at parsing, `with-c-syntax'\nadds '{' and '}' into the head and tail of FORM respectively, and\ntries to parse again.\"\n (cond\n ((null body)\n nil)\n ((and (length= 1 (the list body))\t; with-c-syntax is nested.\n\t (starts-with 'with-c-syntax (first body)))\n (destructuring-bind (op_ options2 &body body2)\n\t (first body)\n (declare (ignore op_))\n `(with-c-syntax (,@options ,@options2) ,@body2)))\n (t\n (ecase preprocess\n (:preprocess-only\n (preprocessor body reader-level readtable-case input-file-pathname))\n (t\n `(with-c-syntax (:preprocess nil :try-add-{} ,try-add-{})\n ,@(preprocessor body reader-level readtable-case input-file-pathname)))\n ((nil)\n (expand-c-syntax body\n\t\t try-add-{}))))))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.9125}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(destructuring-ecase 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by DESTRUCTURING-ECASE", "input": "(destructuring-ecase 'lol-gen::some-name)", "output": "(defmacro destructuring-ecase (keyform &body clauses)\n (expand-destructuring-case keyform clauses 'ecase))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(defproxyprint nil\n (progn))\n\nProblem: Macro call that should be transformed by DEFPROXYPRINT", "input": "(defproxyprint nil\n (progn))", "output": "(defmacro defproxyprint (qualifier node &body body)\n \"define a pretty-print method for a proxy node\"\n `(defproxymethod ,qualifier (pp pretty-printer) ,node ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8374999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(is-values nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by IS-VALUES", "input": "(is-values nil\n (progn))", "output": "(defmacro is-values (form &body body)\n (multiple-value-bind (comp-expected expected comparison description format-args)\n (destructure-is-values-body body)\n `(eval-in-context\n *context*\n (make-instance 'multiple-value-comparison-result\n :expression '(is-values ,form ,@comp-expected)\n :value-form ',form\n :body (lambda () ,form)\n :expected (list ,@expected)\n :comparison (list ,@comparison)\n ,@(when description\n `(:description (format NIL ,description ,@format-args)))))))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.885}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(coalton-toplevel)\n\nProblem: Macro call that should be transformed by COALTON-TOPLEVEL", "input": "(coalton-toplevel)", "output": "(defmacro COALTON-TOPLEVEL ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(fbind* nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by FBIND*", "input": "(fbind* nil\n nil)", "output": "(defmacro fbind* (bindings &body body &environment env)\n \"Like `fbind', but creates bindings sequentially.\"\n (setf bindings (expand-fbindings bindings))\n (unless bindings\n (return-from fbind* `(locally ,@body)))\n (mvlet* ((fn (caar bindings))\n (body decls (parse-body body))\n (local others (partition-declarations `((function ,fn))\n decls\n env)))\n `(fbind (,(first bindings))\n ,@local\n (fbind* ,(rest bindings)\n ,@others\n ,@body))))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.885}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(some-> 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by SOME->", "input": "(some-> 'lol-gen::some-name)", "output": "(defmacro SOME-> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(none-of 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by NONE-OF", "input": "(none-of 'lol-gen::some-name)", "output": "(defmacro NONE-OF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(or nil (progn))\n\nIssue: Macro call that should be transformed by OR", "input": "(or nil (progn))", "output": "(defmacro OR ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(make-instance* nil (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by MAKE-INSTANCE*", "input": "(make-instance* nil (progn))", "output": "(defmacro make-instance* (class &rest arguments)\n \"Convenience macro on top of `make-instance'.\n\nConveniences:\n\n- First argument can be a (possibly empty) list of shortcut symbols,\n which is automatically converted into a KEYWORD+SYMBOL pairs where\n - KEYWORD is the same as shortcut name, but interned as keyword.\n - And SYMBOL is the same as shortcut.\n\n- The last argument can be an apply argument---arbitrary\n list-producing form, which will be used as the last argument\n to (apply #'make-instance ...) idiom.\n\nNote that using a singular shortcut list of apply argument is an\nambiguous case that will be interpreted in favor of apply argument. To\nforce either of interpretations, provide shortcuts and apply arguments\nexplicitly:\n(make-instance* 'class (a b c)) ;; BAD\n(make-instance* 'class (a b c) nil) ;; GOOD\n(make-instance* 'class (when t nil)) ;; BAD\n(make-instance* 'class () (when t nil)) ;; GOOD\n\nOtherwise, the behavior is equivalent to `make-instance'.\n\nExamples:\n\nShortcut args:\n\\(make-instance* 'class (a b c))\n=>\n\\(make-instance 'class :a a :b b :c c)\n\nLast form converted into `apply' argument:\n\\(make-instance* 'class :c c :b b (when something (list :a a)))\n=>\n\\(apply #'make-instance 'class :c c :b b (when something (list :a a)))\n\nShortcut arguments, regular arguments, and form for `apply':\n\\(make-instance* 'class (b c) :x x (when something (list :a a)))\n=>\n\\(apply #'make-instance 'class :b b :c c :x x (when something (list :a a)))\n\nForm for `apply' (notice the empty shortcuts---these are required for\nunambiguous parsing):\n\\(make-instance* 'class () (when something (list :a a)))\n=>\n\\(apply #'make-instance 'class (when something (list :a a)))\n\nRegular `make-instance'-like use:\n\\(make-instance* 'class :a a-value :b b-value)\n=>\n\\(make-instance 'class :a a-value :b b-value)\"\n (when (and (= 1 (length arguments))\n (listp (first arguments)))\n (style-warn \"Body of MAKE-INSTANCE* contains a single list-like form ~a.\n\nIf you meant APPLY args, add empty shortcuts list:\n(make-instance* 'class () (apply-form))\n\nIf you meant shortcut list, add empty APPLY args:\n(make-instance* 'class (shortcuts) nil)\n\nInterpreting as APPLY args for now, but this behavior may change in\nthe future.\" arguments))\n (let* ((shortcuts-p (and (listp (first arguments))\n (> (length arguments) 1)))\n (shortcuts (when shortcuts-p\n (first arguments)))\n (arguments (if shortcuts-p\n (rest arguments)\n arguments))\n (last-appendable-form-p (oddp (length arguments)))\n (last-appendable-form (when last-appendable-form-p\n (first (last arguments))))\n (arguments (if last-appendable-form-p\n (butlast arguments)\n arguments)))\n `(,@(if last-appendable-form-p\n `(apply #'make-instance)\n `(make-instance))\n ,class\n ,@(loop for shortcut in shortcuts\n append (list (intern (symbol-name shortcut) :keyword)\n shortcut))\n ,@arguments\n ,@(when last-appendable-form-p\n (list last-appendable-form)))))", "category": "anaphoric", "technique": "nested-backquote,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.9099999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(iterate\n nil)\n\nIssue: Macro call that should be transformed by ITERATE", "input": "(iterate\n nil)", "output": "(defmacro ITERATE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(maxf nil (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by MAXF", "input": "(maxf nil (progn))", "output": "(defmacro MAXF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(do-for nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by DO-FOR", "input": "(do-for nil\n :key\n nil)", "output": "(defmacro DO-FOR ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(define-generic* nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by DEFINE-GENERIC*", "input": "(define-generic* nil\n (progn))", "output": "(defmacro DEFINE-GENERIC* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(foreign-funcall-pointer nil nil)\n\nWhat needs to change: Macro call that should be transformed by FOREIGN-FUNCALL-POINTER", "input": "(foreign-funcall-pointer nil nil)", "output": "(defmacro foreign-funcall-pointer (pointer options &rest args)\n (foreign-funcall-form pointer options args t))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(js-inline 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by JS-INLINE", "input": "(js-inline 'lol-gen::some-name)", "output": "(defmacro JS-INLINE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-fixtures 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by WITH-FIXTURES", "input": "(with-fixtures 'lol-gen::some-name)", "output": "(defmacro with-fixtures (fixtures &body body)\n `(call-with-fixtures (lambda () ,@body) ,fixtures))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(make-proxy nil (progn))\n\nProblem: Macro call that should be transformed by MAKE-PROXY", "input": "(make-proxy nil (progn))", "output": "(defmacro make-proxy (slot node-type &key (node-name 'item) (parent 'item))\n \"Add proxy nodes to slot. Note: all uses in c-mera and cm-c implicitly assue that the node is called ITEM.\"\n (let ((val (gensym)))\n `(if (or (eql (find-class 'nodelist) (class-of (slot-value ,node-name ',slot))))\n \t (let ((,val (slot-value (slot-value ,node-name ',slot) 'nodes)))\n \t (setf (slot-value (slot-value ,node-name ',slot) 'nodes)\n \t\t (loop for i in ,val collect\n \t\t (make-instance ,node-type\n\t\t\t\t :parent ,parent\n \t\t\t\t :proxy-subnode i\n \t\t\t\t :values '()\n \t\t\t\t :subnodes '(proxy-subnode)))))\n \t (let ((,val (slot-value ,node-name ',slot)))\n \t (if ,val\n \t (setf (slot-value ,node-name ',slot)\n \t\t (make-instance ,node-type\n\t\t\t\t :parent ,parent\n \t\t\t\t :proxy-subnode ,val\n \t\t\t\t :values '()\n \t\t\t\t :subnodes '(proxy-subnode)))\n \t (setf (slot-value ,node-name ',slot)\n \t \t (make-instance ,node-type\n\t\t\t\t :parent ,parent\n \t \t\t\t :proxy-subnode nil\n \t \t\t\t :values '()\n \t \t\t\t :subnodes '(proxy-subnode))))))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "intermediate", "quality_score": 0.7975}
{"instruction": "Generate a defmacro form that transforms code like this:\n(walk-environment\n nil)\n\nPattern to recognize: Macro call that should be transformed by WALK-ENVIRONMENT", "input": "(walk-environment\n nil)", "output": "(defmacro WALK-ENVIRONMENT ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(xhtml nil)\n\nProblem: Macro call that should be transformed by XHTML", "input": "(xhtml nil)", "output": "(defmacro xhtml (&rest tags)\n `(with-doctype :xhtml\n (tag->string (cons :html ',tags))))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(decide 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by DECIDE", "input": "(decide 'lol-gen::some-name)", "output": "(defmacro DECIDE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(defproxyprint nil\n nil)\n\nIssue: Macro call that should be transformed by DEFPROXYPRINT", "input": "(defproxyprint nil\n nil)", "output": "(defmacro defproxyprint (qualifier node &body body)\n \"define a pretty-print method for a proxy node\"\n `(defproxymethod ,qualifier (pp pretty-printer) ,node ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-none-awake nil)\n\nIssue: Macro call that should be transformed by WITH-NONE-AWAKE", "input": "(with-none-awake nil)", "output": "(defmacro with-none-awake ((&key dbg diag) &body body)\n `(call-with-none-awake ,dbg (lambda () ,@body) ,diag))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(define-method-combination 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by DEFINE-METHOD-COMBINATION", "input": "(define-method-combination 'lol-gen::some-name)", "output": "(defmacro DEFINE-METHOD-COMBINATION ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(ematch 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by EMATCH", "input": "(ematch 'lol-gen::some-name)", "output": "(defmacro ematch (what &body clauses)\n #.+match-doc+\n (with-gensyms (otherwise)\n `(match2 ,what\n ,@clauses\n (,otherwise (error 'match-error :pattern ',clauses :values (list ,otherwise))))))", "category": "capture-management", "technique": "gensym", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(count-failures\n nil)\n\nWhat needs to change: Macro call that should be transformed by COUNT-FAILURES", "input": "(count-failures\n nil)", "output": "(defmacro COUNT-FAILURES ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(f_n)\n\nProblem: Macro call that should be transformed by F_N", "input": "(f_n)", "output": "(defmacro F_N ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(defgeneric nil\n nil)\n\nIssue: Macro call that should be transformed by DEFGENERIC", "input": "(defgeneric nil\n nil)", "output": "(defmacro DEFGENERIC ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(push nil (progn))\n\nProblem: Macro call that should be transformed by PUSH", "input": "(push nil (progn))", "output": "(defmacro PUSH ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(iter\n nil\n :key\n nil)\n\nProblem: Macro call that should be transformed by ITER", "input": "(iter\n nil\n :key\n nil)", "output": "(defmacro iter (&body body &environment env)\n \"Jonathan Amsterdam's powerful and extensible iteration facility,\nproviding multiple accumulation, generators, memory of previous\niterations, over 50 clauses to start with and a Lisp-like syntax.\nEvaluate (iterate:display-iterate-clauses) for an overview of clauses\"\n (let* ((*env* env)\n\t (*result-var* (genvar 'result))\n\t (*type-alist* nil)\n\t (*declare-variables* *always-declare-variables*)\n\t (*bindings* nil)\n\t (*internal-variables* nil)\n\t (*previous-vars-alist* nil)\n\t (*declarations* nil)\n\t (*loop-body-wrappers* nil)\n\t (*accum-var-alist* nil)\n\t (*shared-bindings-alist* nil)\n\t (*top-level?* t)\n\t (*binding-context?* nil)\n\t (*temps* nil)\n\t (*temps-in-use* nil)\n\t (*driver-info-alist* nil)\n\t (*loop-name* (if (symbolp (car body))\n\t\t\t (car body)\n\t\t\t (gensym \"ITERATE\")))\n\t (*block-name* (if (symbolp (car body))\n\t\t\t (pop body)\n\t\t\t nil))\n\t (*loop-top* (symbol-append 'loop-top- *block-name*))\n\t (*loop-step* (symbol-append 'loop-step- *block-name*))\n\t (*loop-end* (symbol-append 'loop-end- *block-name*))\n\t (*loop-step-used?* nil)\n\t (*loop-end-used?* nil))\n (process-top-level-decls body)\n (multiple-value-bind (body decls init-code steppers final-code final-prot)\n\t(walk-list body)\n (multiple-value-bind (init step)\n\t (insert-previous-code)\n\t(augment init-code init)\n\t(augment steppers step))\n (prepend (default-driver-code) body)\n (let* ((it-bod `(block ,*loop-name*\n\t\t\t(tagbody\n\t\t\t (progn ,.init-code)\n\t\t\t ,*loop-top*\n\t\t\t (progn ,.body)\n\t\t\t ,.(if *loop-step-used?* (list *loop-step*))\n\t\t\t (progn ,.steppers)\n\t\t\t (go ,*loop-top*)\n\t\t\t ,.(if *loop-end-used?* (list *loop-end*))\n\t\t\t (progn ,.final-code))\n\t\t\t,(if (member *result-var* *bindings* :key #'car)\n\t\t\t *result-var*\n\t\t\t nil)))\n\t (it-bod (if (eql *block-name* nil)\n\t\t\t `(block nil ,it-bod)\n\t\t\t it-bod)))\n\t(wrap-form *loop-body-wrappers*\n\t\t `(let* ,(nreverse *bindings*)\n\t\t ,.(if *declarations*\n\t\t\t `((declare .,*declarations*)))\n\t\t ,.decls\n\t\t ,(if final-prot\n\t\t\t `(unwind-protect ,it-bod .,final-prot)\n\t\t\t it-bod)))))))", "category": "anaphoric", "technique": "tagbody-go,gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.835}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(lambda-coro)\n\nWhat needs to change: Macro call that should be transformed by LAMBDA-CORO", "input": "(lambda-coro)", "output": "(defmacro LAMBDA-CORO ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with-open-files nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by WITH-OPEN-FILES", "input": "(with-open-files nil\n nil)", "output": "(defmacro with-open-files ((&rest args) &body body)\n \"A simple macro to open one or more files providing the streams for the BODY. The ARGS is a list of `(stream filespec options*)` as supplied to WITH-OPEN-FILE.\"\n (case (length args)\n ((0)\n `(progn ,@body))\n ((1)\n `(with-open-file ,(first args) ,@body))\n (t `(with-open-file ,(first args)\n (with-open-files\n ,(rest args) ,@body)))))", "category": "dsl", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.885}
{"instruction": "Generate a defmacro form that transforms code like this:\n(best-value nil (progn))\n\nPattern to recognize: Macro call that should be transformed by BEST-VALUE", "input": "(best-value nil (progn))", "output": "(defmacro BEST-VALUE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(with-dot nil\n nil)\n\nWhat needs to change: Macro call that should be transformed by WITH-DOT", "input": "(with-dot nil\n nil)", "output": "(defmacro with-dot (() &body body)\n `(progn ,@(replace-dot-calls body)))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-array nil\n (progn))\n\nIssue: Macro call that should be transformed by WITH-ARRAY", "input": "(with-array nil\n (progn))", "output": "(defmacro with-array ((&optional (stream '*json-output*)) &body body)\n \"Open a JSON Array, run BODY, then close the Array. Inside the BODY,\nAS-ARRAY-MEMBER or ENCODE-ARRAY-MEMBER should be called to encode\nMembers of the Array.\"\n `(with-aggregate (array #\\[ #\\] ,stream) ,@body))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(ecase-of nil\n nil)\n\nProblem: Macro call that should be transformed by ECASE-OF", "input": "(ecase-of nil\n nil)", "output": "(defmacro ecase-of (type x &body body)\n \"Like `ecase' but, given a TYPE (which should be defined as `(member\n...)'), warn, at compile time, unless the keys in BODY are all of TYPE\nand, taken together, they form an exhaustive partition of TYPE.\"\n (once-only (x)\n `(case-of ,type ,x\n ,@body\n (otherwise\n (error 'type-error\n :datum ,x\n :expected-type ',type)))))", "category": "control-flow", "technique": "once-only", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(wait-on nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by WAIT-ON", "input": "(wait-on nil\n nil)", "output": "(defmacro wait-on (hook args &body body)\n \"Wait until HOOK is run.\nNote that it does not necessarily wait until hook has finished running all\nhandlers.\nReturn the BODY return value.\"\n (alexandria:with-gensyms (promise)\n (let ((handler-name (gensym \"wait-on-handler\"))\n (args (alexandria:ensure-list args)))\n (alexandria:once-only (hook)\n `(let ((,promise (make-promise)))\n (add-hook\n ,hook (make-instance 'handler\n :fn (lambda ,args\n (declare (ignorable ,@args))\n (remove-hook ,hook (quote ,handler-name))\n (fulfill ,promise (progn ,@body)))\n :name (quote ,handler-name)))\n (force ,promise))))))", "category": "anaphoric", "technique": "once-only,gensym,anaphor", "complexity": "intermediate", "quality_score": 0.7975}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(doc common-lisp:nil\n common-lisp:nil)\n\nIssue: Macro call that should be transformed by DOC", "input": "(doc common-lisp:nil\n common-lisp:nil)", "output": "(defmacro DOC ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(fbindrec nil\n :key\n nil)\n\nIssue: Macro call that should be transformed by FBINDREC", "input": "(fbindrec nil\n :key\n nil)", "output": "(defmacro fbindrec (bindings &body body &environment *lexenv*)\n \"Like `fbind', but creates recursive bindings.\n\nThe consequences of referring to one binding in the expression that\ngenerates another are undefined.\"\n (setf bindings (expand-fbindings bindings))\n (unless bindings\n (return-from fbindrec `(locally ,@body)))\n (mvlet* ((env env-decls bindings lambdas (analyze-fbinds bindings *lexenv*))\n (body decls (parse-body body))\n (simple complex lambda unref\n (partition-fbinds (append bindings lambdas)\n body))\n (temps (mapcar (op (gensym (string (first _)))) complex))\n (simple-decls complex-decls lambda-decls others\n (partition-declarations-by-kind simple complex lambda decls)))\n `(let ,env\n ,@(unsplice (and env-decls `(declare ,@env-decls)))\n ;; Simple expressions reference functions already defined\n ;; outside of the letrec, so we can handle them with fbind.\n (comment \"fbind: Simple\")\n (fbind ,simple\n ,@simple-decls\n (comment \"fbind: Temps for complex bindings\")\n (let ,(loop for temp in temps collect `(,temp #'invalid))\n (declare ,@(loop for temp in temps collect `(function ,temp)))\n (flet ,(loop for (name nil) in complex\n for temp in temps\n collect (build-bind/ftype name temp complex-decls env))\n ,@complex-decls\n (comment \"fbind: Lambdas\")\n (labels (,@(loop for (name lambda) in lambda\n collect `(,name ,@(cdr lambda))))\n ,@lambda-decls\n (comment \"fbind: Unreferenced\")\n (progn ,@(mapcar #'second unref))\n (comment \"fbind: Complex\")\n (psetf ,@(loop for temp in temps\n for (nil expr) in complex\n append `(,temp (ensure-function ,expr))))\n (locally ,@others\n ,@body))))))))", "category": "control-flow", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Generate a defmacro form that transforms code like this:\n(with-shuffling\n nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by WITH-SHUFFLING", "input": "(with-shuffling\n nil\n nil)", "output": "(defmacro with-shuffling (&body body)\n (let ((thunk (gensym \"THUNK\")))\n `(dolist (,thunk (shuffle\n (list ,@(loop for form in body\n collect `(lambda () ,form)))))\n (funcall ,thunk))))", "category": "dsl", "technique": "gensym", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(make-simple-appender-to-place nil)\n\nIssue: Macro call that should be transformed by MAKE-SIMPLE-APPENDER-TO-PLACE", "input": "(make-simple-appender-to-place nil)", "output": "(defmacro MAKE-SIMPLE-APPENDER-TO-PLACE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(iter\n nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by ITER", "input": "(iter\n nil\n :key\n nil)", "output": "(defmacro iter (&body body &environment env)\n \"Jonathan Amsterdam's powerful and extensible iteration facility,\nproviding multiple accumulation, generators, memory of previous\niterations, over 50 clauses to start with and a Lisp-like syntax.\nEvaluate (iter:display-iter-clauses) for an overview of clauses.\"\n (let* ((*env* env)\n (*result-var* (genvar 'result))\n (*type-alist* nil)\n (*declare-variables* *always-declare-variables*)\n (*bindings* nil)\n (*internal-variables* nil)\n (*previous-vars-alist* nil)\n (*declarations* nil)\n (*loop-body-wrappers* nil)\n (*accum-var-alist* nil)\n (*shared-bindings-alist* nil)\n (*top-level?* t)\n (*declaration-context?* nil)\n (*temps* nil)\n (*temps-in-use* nil)\n (*driver-info-alist* nil)\n (*block-name* (when (symbolp (car body))\n (pop body)))\n (*loop-top* (ensure-symbol *block-name* :format \"loop-top-~a\"))\n (*loop-step* (ensure-symbol *block-name* :format \"loop-step-~a\"))\n (*loop-end* (ensure-symbol *block-name* :format \"loop-end-~a\"))\n (*loop-step-used?* nil)\n (*loop-end-used?* nil))\n (process-top-level-decls body)\n (multiple-value-bind (body decls init-code steppers final-code final-prot)\n (walk-list body)\n (multiple-value-bind (init step)\n (insert-previous-code)\n (augment init-code init)\n (augment steppers step)\n (prepend (default-driver-code) body)\n (let ((it-bod `(block ,*block-name*\n (tagbody\n ,.init-code\n ,*loop-top*\n ,.body\n ,.(when *loop-step-used?* (list *loop-step*))\n ,.steppers\n (go ,*loop-top*)\n ,.(when *loop-end-used?* (list *loop-end*))\n ,.final-code)\n ,(if (member *result-var* *bindings* :key #'car)\n *result-var*\n nil))))\n (wrap-form *loop-body-wrappers*\n `(let* ,(nreverse *bindings*)\n ,.(if *declarations*\n `((declare .,*declarations*)))\n ,.decls\n ,(if final-prot\n `(unwind-protect ,it-bod .,final-prot)\n it-bod))))))))", "category": "anaphoric", "technique": "tagbody-go,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(incf nil (progn))\n\nProblem: Macro call that should be transformed by INCF", "input": "(incf nil (progn))", "output": "(defmacro INCF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(ignorable common-lisp:nil)\n\nPattern to recognize: Macro call that should be transformed by IGNORABLE", "input": "(ignorable common-lisp:nil)", "output": "(defmacro IGNORABLE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(eval-when-execute\n 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by EVAL-WHEN-EXECUTE", "input": "(eval-when-execute\n 'lol-gen::some-name)", "output": "(defmacro EVAL-WHEN-EXECUTE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(cond-<>>\n 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by COND-<>>", "input": "(cond-<>>\n 'lol-gen::some-name)", "output": "(defmacro COND-<>> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(swhen nil\n :key\n nil)\n\nPattern to recognize: Macro call that should be transformed by SWHEN", "input": "(swhen nil\n :key\n nil)", "output": "(defmacro swhen (test &body body)\n \"Like WHEN, except binds the test form to IT (via SYMBOL-MACROLET) for the\nscope of the body. IT can be set with SETF.\"\n `(symbolic when ,test ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(with-transaction 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by WITH-TRANSACTION", "input": "(with-transaction 'lol-gen::some-name)", "output": "(defmacro with-transaction ((&optional name isolation-level) &body body)\n \"Execute the given body within a database transaction, committing it when the\nbody exits normally, and aborting otherwise. An optional name and/or\nisolation-level can be given to the transaction. The name can be used to force\na commit or abort before the body unwinds. The isolation-level will set the\nisolation-level used by the transaction.\n\nYou can specify the following isolation levels in postmodern transactions:\n\n- :read-committed-rw (read committed with read and write)\n- :read-committed-ro (read committed with read only)\n- :repeatable-read-rw (repeatable read with read and write)\n- :repeatable-read-ro (repeatable read with read only)\n- :serializable (serializable with reand and write)\n\nSample usage where george is just the name given to the transaction (not quoted\nor a string) and ... simply indicates other statements would be expected here:\n\n (with-transaction ()\n (execute (:insert-into 'test-data :set 'value 77))\n ...)\n\n (with-transaction (george)\n (execute (:insert-into 'test-data :set 'value 22))\n ...)\n\n (with-transaction (george :read-committed-rw)\n (execute (:insert-into 'test-data :set 'value 33))\n (query (:select '* :from 'test-data))\n ...)\n\n (with-transaction (:serializable)\n (execute (:insert-into 'test-data :set 'value 44))\n ...)\n\nFurther discussion of transactions and isolation levels can found in the\nisolation notes file in the doc folder.\"\n (let ((transaction-name (or (when (not (isolation-level-p name))\n name)\n (gensym \"anonymous-transaction\"))))\n (when (and name (isolation-level-p name))\n (setf isolation-level name))\n `(call-with-transaction (lambda (,transaction-name)\n (declare (ignorable ,transaction-name)) ,@body)\n ,isolation-level)))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.85}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(-> nil :key nil)\n\nWhat needs to change: Macro call that should be transformed by ->", "input": "(-> nil :key nil)", "output": "(defmacro -> (x &rest forms)\n \"Threads the expr through FORMS. Inserts X as the\n second item in the first form, or in place of % if it is present in the form,\n making a list of it if it is not a list already.\n If there are more forms, inserts the first form\n as the second item in second form, etc.\"\n (if (first forms)\n (let* ((form (first forms))\n (threaded (if (listp form)\n (if (member '% form)\n `(funcall (lambda (%) ,form) ,x)\n `(,(first form) ,x ,@(rest form)))\n `(,form ,x))))\n `(-> ,threaded ,@(rest forms)))\n x))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "intermediate", "quality_score": 0.885}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(class/std nil\n (progn))\n\nProblem: Macro call that should be transformed by CLASS/STD", "input": "(class/std nil\n (progn))", "output": "(defmacro class/std (name &body defaulted-slots)\n \"The most concise shortcut macro to DEFCLASS.\n\n (class/std example slot1 slot2 slot3)\n\n expands to:\n\n (DEFCLASS/STD EXAMPLE ()\n ((SLOT1 SLOT2 SLOT3)))\n\n which expands to:\n\n (DEFCLASS EXAMPLE ()\n ((SLOT1 :ACCESSOR SLOT1 :INITARG :SLOT1 :INITFORM NIL)\n (SLOT2 :ACCESSOR SLOT2 :INITARG :SLOT2 :INITFORM NIL)\n (SLOT3 :ACCESSOR SLOT3 :INITARG :SLOT3 :INITFORM NIL)))\n\"\n `(defclass/std ,name ()\n ((,@defaulted-slots))))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Generate a defmacro form that transforms code like this:\n(as-> nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by AS->", "input": "(as-> nil\n nil)", "output": "(defmacro AS-> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(inext nil (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by INEXT", "input": "(inext nil (progn))", "output": "(defmacro INEXT ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(define-global-parameter nil nil)\n\nPattern to recognize: Macro call that should be transformed by DEFINE-GLOBAL-PARAMETER", "input": "(define-global-parameter nil nil)", "output": "(defmacro DEFINE-GLOBAL-PARAMETER ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(bcond)\n\nIssue: Macro call that should be transformed by BCOND", "input": "(bcond)", "output": "(defmacro bcond (&body clauses)\n \"Scheme's extended COND.\n\nThis is exactly like COND, except for clauses having the form\n\n (test :=> recipient)\n\nIn that case, if TEST evaluates to a non-nil result, then RECIPIENT, a\nfunction, is called with that result, and the result of RECIPIENT is\nreturn as the value of the `cond`.\n\nAs an extension, a clause like this:\n\n (test :=> var ...)\n\nCan be used as a shorthand for\n\n (test :=> (lambda (var) ...))\n\nThe name `bcond' for a \u201cbinding cond\u201d goes back at least to the days\nof the Lisp Machines. I do not know who was first to use it, but the\noldest examples I have found are by Michael Parker and Scott L.\nBurson.\"\n (flet ((send-clause? (clause)\n (let ((second (second clause)))\n (and (symbolp second)\n (string= second :=>))))\n (parse-send-clause (clause)\n (destructuring-bind (test => . body) clause\n (declare (ignore =>))\n (cond ((null body) (error \"Missing clause\"))\n ((null (rest body))\n (values test (car body)))\n (t (destructuring-bind (var . body) body\n (let ((fn `(lambda (,var) ,@body)))\n (values test fn))))))))\n ;; Note that we expand into `cond' rather than `if' so we don't\n ;; have to handle tests without bodies.\n (cond ((null clauses) nil)\n ((member-if #'send-clause? clauses)\n (let* ((tail (member-if #'send-clause? clauses))\n (preceding (ldiff clauses tail))\n (clause (car tail))\n (clauses (cdr tail)))\n (multiple-value-bind (test fn)\n (parse-send-clause clause)\n (with-gensyms (tmp)\n `(cond ,@preceding\n (t (if-let1 ,tmp ,test\n (funcall ,fn ,tmp)\n (bcond ,@clauses))))))))\n (t `(cond ,@clauses)))))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.7649999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(some->>\n 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by SOME->>", "input": "(some->>\n 'lol-gen::some-name)", "output": "(defmacro SOME->> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(ecase nil)\n\nProblem: Macro call that should be transformed by ECASE", "input": "(ecase nil)", "output": "(defmacro ECASE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(with-truncated-stack nil\n :key\n nil)\n\nProblem: Macro call that should be transformed by WITH-TRUNCATED-STACK", "input": "(with-truncated-stack nil\n :key\n nil)", "output": "(defmacro with-truncated-stack (() &body body)\n `(stack-truncator (lambda () ,@body)))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(drelet 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by DRELET", "input": "(drelet 'lol-gen::some-name)", "output": "(defmacro DRELET ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(in-package nil)\n\nPattern to recognize: Macro call that should be transformed by IN-PACKAGE", "input": "(in-package nil)", "output": "(defmacro IN-PACKAGE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(.> common-lisp:nil)\n\nProblem: Macro call that should be transformed by .>", "input": "(.> common-lisp:nil)", "output": "(defmacro .> (cl:&rest items)\n \"Left associative compose operator. Creates a new functions that will run the\nfunctions left to right when applied. This is the same as the `pipe` macro without supplying\nthe value. The composition is thus the reverse order of `compose`.\n\n`(.> f g h)` creates the function `(fn (x) (h (g (f x))))`.\"\n (alexandria:with-gensyms (x)\n `(fn (,x)\n (pipe ,x ,@items))))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.835}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(left 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by LEFT", "input": "(left 'lol-gen::some-name)", "output": "(defmacro left (parser &rest parsers)\n \"Combination of parsers yielding the result of the leftmost one.\"\n `(<* ,parser ,@parsers))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(fm-other? nil (progn))\n\nProblem: Macro call that should be transformed by FM-OTHER?", "input": "(fm-other? nil (progn))", "output": "(defmacro fm-other? (md-name &optional (starting 'self) (global-search t))\n `(fm-find-one ,starting ,(if (consp md-name)\n `(list ',(car md-name) ,(cadr md-name))\n `',md-name)\n :must-find nil\n :global-search ,global-search))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(full-join nil)\n\nPattern to recognize: Macro call that should be transformed by FULL-JOIN", "input": "(full-join nil)", "output": "(defmacro full-join (table &key on using)\n `(join ,table :kind :full :on ,on :using ,using))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(c_in\n nil)\n\nWhat needs to change: Macro call that should be transformed by C_IN", "input": "(c_in\n nil)", "output": "(defmacro c_in (&body body)\n `(c-input (:lazy :once-asked) (progn ,@body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(-> nil nil)\n\nPattern to recognize: Macro call that should be transformed by ->", "input": "(-> nil nil)", "output": "(defmacro -> (functions (&rest args) &optional values)\n \"Declaim the ftype of one or multiple FUNCTIONS from ARGS to VALUES.\n\n (-> mod-fixnum+ (fixnum fixnum) fixnum)\n (defun mod-fixnum+ (x y) ...)\n\n (-> (mod-float+ mod-single-float+) (float float) float)\n (defun mod-float+ (x y) ...)\n (defun mode-single-float+ (x y) ...)\"\n `(declaim (ftype (-> (,@args) ,@(when values\n (list values)))\n\t\t ,@(if (consp functions)\n\t\t\t (if (find-symbol (symbol-name (first functions))\n\t\t\t\t\t :cl)\n\t\t\t (list functions)\n\t\t\t functions)\n\t\t\t (list functions)))))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(inline common-lisp:nil\n common-lisp:nil)\n\nWrite a macro that addresses: Macro call that should be transformed by INLINE", "input": "(inline common-lisp:nil\n common-lisp:nil)", "output": "(defmacro INLINE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(define-class-method nil\n :key\n nil)\n\nPattern to recognize: Macro call that should be transformed by DEFINE-CLASS-METHOD", "input": "(define-class-method nil\n :key\n nil)", "output": "(defmacro DEFINE-CLASS-METHOD ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(without-symbol-access\n nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by WITHOUT-SYMBOL-ACCESS", "input": "(without-symbol-access\n nil\n :key\n nil)", "output": "(defmacro WITHOUT-SYMBOL-ACCESS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(some-<> nil)\n\nWrite a macro that addresses: Macro call that should be transformed by SOME-<>", "input": "(some-<> nil)", "output": "(defmacro SOME-<> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(incf nil)\n\nProblem: Macro call that should be transformed by INCF", "input": "(incf nil)", "output": "(defmacro INCF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(make nil :key nil)\n\nPattern to recognize: Macro call that should be transformed by MAKE", "input": "(make nil :key nil)", "output": "(defmacro MAKE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(jif nil nil)\n\nPattern to recognize: Macro call that should be transformed by JIF", "input": "(jif nil nil)", "output": "(defmacro jif (test then &optional (else nil))\n \"JSON-aware version of `cl:if'.\nIf TEST is `jtruep' evaluate THEN, otherwise evaluate ELSE.\"\n `(if (jtruep ,test)\n ,then\n ,else))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-attributes nil\n :key\n nil)\n\nIssue: Macro call that should be transformed by WITH-ATTRIBUTES", "input": "(with-attributes nil\n :key\n nil)", "output": "(defmacro WITH-ATTRIBUTES ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(vect-of nil (progn))\n\nPattern to recognize: Macro call that should be transformed by VECT-OF", "input": "(vect-of nil (progn))", "output": "(defmacro VECT-OF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(->> nil)\n\nIssue: Macro call that should be transformed by ->>", "input": "(->> nil)", "output": "(defmacro ->> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(for-effects\n nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by FOR-EFFECTS", "input": "(for-effects\n nil\n :key\n nil)", "output": "(defmacro FOR-EFFECTS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with-cc nil\n :key\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by WITH-CC", "input": "(with-cc nil\n :key\n nil)", "output": "(defmacro with-cc (id &body body)\n `(with-integrity (:change ,id)\n ,@body))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(def$flavor nil :key nil)\n\nIssue: Macro call that should be transformed by DEF$FLAVOR", "input": "(def$flavor nil :key nil)", "output": "(defmacro DEF$FLAVOR ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(with-guessing-encoder\n nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by WITH-GUESSING-ENCODER", "input": "(with-guessing-encoder\n nil\n :key\n nil)", "output": "(defmacro with-guessing-encoder (&body body)\n `(with-local-encoder (use-guessing-encoder)\n ,@body))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8374999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(keep-bops nil)\n\nPattern to recognize: Macro call that should be transformed by KEEP-BOPS", "input": "(keep-bops nil)", "output": "(defmacro KEEP-BOPS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(with-collectors nil)\n\nWhat needs to change: Macro call that should be transformed by WITH-COLLECTORS", "input": "(with-collectors nil)", "output": "(defmacro with-collectors ((&rest collectors) &body body)\n \"Like `with-collector', with multiple collectors.\nReturns the final value of each collector as multiple values.\n\n (with-collectors (x y z)\n (x 1)\n (y 2)\n (z 3))\n => '(1) '(2) '(3)\"\n ;; Warn if there are duplications in COLLECTORS.\n (when (> (length collectors)\n (length (remove-duplicates collectors)))\n (warn \"Duplicated collectors in with-collectors form: ~s\" collectors))\n (with-gensyms (outer)\n `(block ,outer\n ,(reduce (lambda (form collector)\n `(with-collector (,collector)\n ,form))\n collectors\n :initial-value\n `(progn\n ,@body\n (return-from ,outer\n (values ,@(mapcar #'list collectors))))))))", "category": "capture-management", "technique": "gensym,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(ignore-errors nil (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by IGNORE-ERRORS", "input": "(ignore-errors nil (progn))", "output": "(defmacro IGNORE-ERRORS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(collect-or 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by COLLECT-OR", "input": "(collect-or 'lol-gen::some-name)", "output": "(defmacro COLLECT-OR ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(adowhile 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by ADOWHILE", "input": "(adowhile 'lol-gen::some-name)", "output": "(defmacro ADOWHILE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(lambda () nil)\n\nWrite a macro that addresses: Macro call that should be transformed by LAMBDA", "input": "(lambda () nil)", "output": "(defmacro LAMBDA ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(once-only nil\n :key\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by ONCE-ONLY", "input": "(once-only nil\n :key\n nil)", "output": "(defmacro once-only (specs &body forms)\n \"Constructs code whose primary goal is to help automate the handling of\nmultiple evaluation within macros. Multiple evaluation is handled by introducing\nintermediate variables, in order to reuse the result of an expression.\n\nThe returned value is a list of the form\n\n (let ((<gensym-1> <expr-1>)\n ...\n (<gensym-n> <expr-n>))\n <res>)\n\nwhere GENSYM-1, ..., GENSYM-N are the intermediate variables introduced in order\nto evaluate EXPR-1, ..., EXPR-N once, only. RES is code that is the result of\nevaluating the implicit progn FORMS within a special context determined by\nSPECS. RES should make use of (reference) the intermediate variables.\n\nEach element within SPECS is either a symbol SYMBOL or a pair (SYMBOL INITFORM).\nBare symbols are equivalent to the pair (SYMBOL SYMBOL).\n\nEach pair (SYMBOL INITFORM) specifies a single intermediate variable:\n\n- INITFORM is an expression evaluated to produce EXPR-i\n\n- SYMBOL is the name of the variable that will be bound around FORMS to the\n corresponding gensym GENSYM-i, in order for FORMS to generate RES that\n references the intermediate variable\n\nThe evaluation of INITFORMs and binding of SYMBOLs resembles LET. INITFORMs of\nall the pairs are evaluated before binding SYMBOLs and evaluating FORMS.\n\nExample:\n\n The following expression\n\n (let ((x '(incf y)))\n (once-only (x)\n `(cons ,x ,x)))\n\n ;;; =>\n ;;; (let ((#1=#:X123 (incf y)))\n ;;; (cons #1# #1#))\n\n could be used within a macro to avoid multiple evaluation like so\n\n (defmacro cons1 (x)\n (once-only (x)\n `(cons ,x ,x)))\n\n (let ((y 0))\n (cons1 (incf y)))\n\n ;;; => (1 . 1)\n\nExample:\n\n The following expression demonstrates the usage of the INITFORM field\n\n (let ((expr '(incf y)))\n (once-only ((var `(1+ ,expr)))\n `(list ',expr ,var ,var)))\n\n ;;; =>\n ;;; (let ((#1=#:VAR123 (1+ (incf y))))\n ;;; (list '(incf y) #1# #1))\n\n which could be used like so\n\n (defmacro print-succ-twice (expr)\n (once-only ((var `(1+ ,expr)))\n `(format t \\\"Expr: ~s, Once: ~s, Twice: ~s~%\\\" ',expr ,var ,var)))\n\n (let ((y 10))\n (print-succ-twice (incf y)))\n\n ;;; >>\n ;;; Expr: (INCF Y), Once: 12, Twice: 12\"\n (let ((gensyms (make-gensym-list (length specs) \"ONCE-ONLY\"))\n (names-and-forms (mapcar (lambda (spec)\n (etypecase spec\n (list\n (destructuring-bind (name form) spec\n (cons name form)))\n (symbol\n (cons spec spec))))\n specs)))\n ;; bind in user-macro\n `(let ,(mapcar (lambda (g n) (list g `(gensym ,(string (car n)))))\n gensyms names-and-forms)\n ;; bind in final expansion\n `(let (,,@(mapcar (lambda (g n)\n ``(,,g ,,(cdr n)))\n gensyms names-and-forms))\n ;; bind in user-macro\n ,(let ,(mapcar (lambda (n g) (list (car n) g))\n names-and-forms gensyms)\n ,@forms)))))", "category": "control-flow", "technique": "once-only,gensym,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(some->> 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by SOME->>", "input": "(some->> 'lol-gen::some-name)", "output": "(defmacro SOME->> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(group-by nil nil)\n\nPattern to recognize: Macro call that should be transformed by GROUP-BY", "input": "(group-by nil nil)", "output": "(defmacro GROUP-BY ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(jif nil :key nil)\n\nWrite a macro that addresses: Macro call that should be transformed by JIF", "input": "(jif nil :key nil)", "output": "(defmacro jif (test then &optional (else nil))\n \"JSON-aware version of `cl:if'.\nIf TEST is `jtruep' evaluate THEN, otherwise evaluate ELSE.\"\n `(if (jtruep ,test)\n ,then\n ,else))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(with-integrity nil :key nil)\n\nWhat needs to change: Macro call that should be transformed by WITH-INTEGRITY", "input": "(with-integrity nil :key nil)", "output": "(defmacro with-integrity ((&optional opcode defer-info debug) &rest body)\n (declare (ignorable debug))\n (when opcode\n (assert (find opcode *ufb-opcodes*) ()\n \"Invalid opcode for with-integrity: ~a. Allowed values: ~a\" opcode *ufb-opcodes*))\n `(call-with-integrity ,opcode ,defer-info\n (lambda (opcode defer-info)\n (declare (ignorable opcode defer-info))\n ;;; ,(when debug\n ;;; `(trc \"integrity action entry\" opcode defer-info ',body))\n ;;; (when *c-debug*\n ;;; (when (eq opcode :change)\n ;;; (trc \"-------w/integ :change go--------------->:\" defer-info)))\n ,@body)\n nil\n #+noway (when *c-debug* ',body)))", "category": "dsl", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(caching-types\n nil\n :key\n nil)\n\nIssue: Macro call that should be transformed by CACHING-TYPES", "input": "(caching-types\n nil\n :key\n nil)", "output": "(defmacro CACHING-TYPES ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(slet 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by SLET", "input": "(slet 'lol-gen::some-name)", "output": "(defmacro slet (form &body body)\n \"Binds the FORM to IT (via SYMBOL-MACROLET) in the scope of the BODY. IT can\nbe set with SETF.\"\n `(symbolic ignore-first ,form (progn ,@body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(eval-when-compile\n 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by EVAL-WHEN-COMPILE", "input": "(eval-when-compile\n 'lol-gen::some-name)", "output": "(defmacro EVAL-WHEN-COMPILE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(as-> nil\n :key\n nil)\n\nProblem: Macro call that should be transformed by AS->", "input": "(as-> nil\n :key\n nil)", "output": "(defmacro AS-> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with-synapse nil\n :key\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by WITH-SYNAPSE", "input": "(with-synapse nil\n :key\n nil)", "output": "(defmacro with-synapse (synapse-id (&rest closure-vars) &body body)\n (let ((syn-id (gensym)))\n `(let* ((,syn-id ,synapse-id)\n (synapse (or (find ,syn-id (cd-useds *depender*) :key 'c-slot-name)\n (let ((new-syn\n (let (,@closure-vars)\n (make-c-dependent\n :model (c-model *depender*)\n :slot-name ,syn-id\n :code ',body\n :synaptic t\n :rule (c-lambda ,@body)))))\n (record-caller new-syn)\n new-syn))))\n (prog1\n (multiple-value-bind (v p)\n (with-integrity ()\n (ensure-value-is-current synapse :synapse *depender*))\n (values v p))\n (record-caller synapse)))))", "category": "dsl", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Generate a defmacro form that transforms code like this:\n(optimize common-lisp:nil\n common-lisp:nil)\n\nPattern to recognize: Macro call that should be transformed by OPTIMIZE", "input": "(optimize common-lisp:nil\n common-lisp:nil)", "output": "(defmacro OPTIMIZE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(when 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by WHEN", "input": "(when 'lol-gen::some-name)", "output": "(defmacro WHEN ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n;; Accessing pandoric variables requires verbose funcall\n(let ((sum (funcall box :pandoric-get 'sum))\n (count (funcall box :pandoric-get 'count)))\n (format t \"sum=~a count=~a~%\" sum count))\n\n;; Setting is even worse:\n(progn\n (funcall box :pandoric-set 'sum new-value)\n new-value)\n\n;; Want: regular variable syntax for pandoric access\n\nProblem: Pandoric get/set requires verbose keyword funcalls \u2014 want transparent variable syntax using symbol-macrolet", "input": ";; Accessing pandoric variables requires verbose funcall\n(let ((sum (funcall box :pandoric-get 'sum))\n (count (funcall box :pandoric-get 'count)))\n (format t \"sum=~a count=~a~%\" sum count))\n\n;; Setting is even worse:\n(progn\n (funcall box :pandoric-set 'sum new-value)\n new-value)\n\n;; Want: regular variable syntax for pandoric access", "output": "(defun get-pandoric (box sym)\n (funcall box :pandoric-get sym))\n\n(defsetf get-pandoric (box sym) (val)\n `(progn\n (funcall ,box :pandoric-set ,sym ,val)\n ,val))\n\n(defmacro with-pandoric (syms box &rest body)\n (let ((g!box (gensym \"box\")))\n `(let ((,g!box ,box))\n (declare (ignorable ,g!box))\n (symbol-macrolet\n (,@(mapcar #`(,a1 (get-pandoric ,g!box ',a1))\n syms))\n ,@body))))", "category": "dispatch", "technique": "symbol-macrolet,defsetf,gensym", "complexity": "advanced", "quality_score": 0.9824999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(rem-bops)\n\nProblem: Macro call that should be transformed by REM-BOPS", "input": "(rem-bops)", "output": "(defmacro REM-BOPS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(with-explicit-encoder\n nil\n nil)\n\nProblem: Macro call that should be transformed by WITH-EXPLICIT-ENCODER", "input": "(with-explicit-encoder\n nil\n nil)", "output": "(defmacro with-explicit-encoder (&body body)\n `(with-local-encoder (use-explicit-encoder)\n ,@body))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8374999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(left nil)\n\nPattern to recognize: Macro call that should be transformed by LEFT", "input": "(left nil)", "output": "(defmacro left (parser &rest parsers)\n \"Combination of parsers yielding the result of the leftmost one.\"\n `(<* ,parser ,@parsers))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(special common-lisp:nil\n (common-lisp:progn))\n\nWrite a macro that addresses: Macro call that should be transformed by SPECIAL", "input": "(special common-lisp:nil\n (common-lisp:progn))", "output": "(defmacro SPECIAL ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(one-value nil (progn))\n\nProblem: Macro call that should be transformed by ONE-VALUE", "input": "(one-value nil (progn))", "output": "(defmacro ONE-VALUE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(html nil)\n\nPattern to recognize: Macro call that should be transformed by HTML", "input": "(html nil)", "output": "(defmacro html (&rest tags)\n `(with-doctype :html\n (tag->string (cons :html ',tags))))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(define-dispatch nil\n (progn))\n\nIssue: Macro call that should be transformed by DEFINE-DISPATCH", "input": "(define-dispatch nil\n (progn))", "output": "(defmacro define-dispatch (name lambda-list &body body)\n \"the lambda list should accept two arguments:\nthe list of arguments given by the current method call.\nthe specific hooks (as named or unamed functions) for the qualified method (that we will be dispatching from).\n\nyou should then use the arguments to dispatch the specific hooks as you wish in the body.\nif the body returns a result, by default the method will also return that result, this can be overriden with finalize-dispatch-method.\n\nSee finalize-dispatch-method\nSee dispatch\"\n `(let ((new-dispatch (make-dispatcher (lambda ,lambda-list ,@body))))\n (setf (gethash ',name *dispatch-table*)\n new-dispatch)))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(let-match* common-lisp:nil\n common-lisp:nil)\n\nWhat needs to change: Macro call that should be transformed by LET-MATCH*", "input": "(let-match* common-lisp:nil\n common-lisp:nil)", "output": "(defmacro let-match* (bindings &body body)\n \"Similar to LET-MATCH but matches sequentially.\"\n (reduce (lambda (binding form) `(let-match (,binding) ,form))\n bindings\n :from-end t\n :initial-value `(locally ,.body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(where nil)\n\nPattern to recognize: Macro call that should be transformed by WHERE", "input": "(where nil)", "output": "(defmacro WHERE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(is nil)\n\nWhat needs to change: Macro call that should be transformed by IS", "input": "(is nil)", "output": "(defmacro is (test &rest reason-args)\n \"The DWIM checking operator.\n\nIf TEST returns a true value a test-passed result is generated,\notherwise a test-failure result is generated. The reason, unless\nREASON-ARGS is provided, is generated based on the form of TEST:\n\n (predicate expected actual) - Means that we want to check\n whether, according to PREDICATE, the ACTUAL value is\n in fact what we EXPECTED.\n\n (predicate value) - Means that we want to ensure that VALUE\n satisfies PREDICATE.\n\n Wrapping the TEST form in a NOT simply produces a negated reason\n string.\"\n (assert (listp test)\n (test)\n \"Argument to IS must be a list, not ~S\" test)\n (let (bindings effective-test default-reason-args)\n (with-gensyms (e a v)\n (flet ((process-entry (predicate expected actual &optional negatedp)\n ;; make sure EXPECTED is holding the entry that starts with 'values\n (when (and (consp actual)\n (eq (car actual) 'values))\n (assert (not (and (consp expected)\n (eq (car expected) 'values))) ()\n \"Both the expected and actual part is a values expression.\")\n (rotatef expected actual))\n (let ((setf-forms))\n (if (and (consp expected)\n (eq (car expected) 'values))\n (progn\n (setf expected (copy-list expected))\n (setf setf-forms (loop for cell = (rest expected) then (cdr cell)\n for i from 0\n while cell\n when (eq (car cell) '*)\n collect `(setf (elt ,a ,i) nil)\n and do (setf (car cell) nil)))\n (setf bindings (list (list e `(list ,@(rest expected)))\n (list a `(multiple-value-list ,actual)))))\n (setf bindings (list (list e expected)\n (list a actual))))\n (setf effective-test `(progn\n ,@setf-forms\n ,(if negatedp\n `(not (,predicate ,e ,a))\n `(,predicate ,e ,a)))))))\n (list-match-case test\n ((not (?predicate ?expected ?actual))\n (process-entry ?predicate ?expected ?actual t)\n (setf default-reason-args\n (list \"~2&~S~2% evaluated to ~2&~S~2% which is ~2&~S~2%to ~2&~S~2% (it should not be)\"\n `',?actual a `',?predicate e)))\n ((not (?satisfies ?value))\n (setf bindings (list (list v ?value))\n effective-test `(not (,?satisfies ,v))\n default-reason-args\n (list \"~2&~S~2% evaluated to ~2&~S~2% which satisfies ~2&~S~2% (it should not)\"\n `',?value v `',?satisfies)))\n ((?predicate ?expected ?actual)\n (process-entry ?predicate ?expected ?actual)\n (setf default-reason-args\n (list \"~2&~S~2% evaluated to ~2&~S~2% which is not ~2&~S~2% to ~2&~S~2%\"\n `',?actual a `',?predicate e)))\n ((?satisfies ?value)\n (setf bindings (list (list v ?value))\n effective-test `(,?satisfies ,v)\n default-reason-args\n (list \"~2&~S~2% evaluated to ~2&~S~2% which does not satisfy ~2&~S~2%\"\n `',?value v `',?satisfies)))\n (?_\n (setf bindings '()\n effective-test test\n default-reason-args (list \"~2&~S~2% was NIL.\" `',test)))))\n `(let ,bindings\n (if ,effective-test\n (add-result 'test-passed :test-expr ',test)\n (process-failure ',test\n ,@(or reason-args default-reason-args)))))))", "category": "capture-management", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(defmethod 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by DEFMETHOD", "input": "(defmethod 'lol-gen::some-name)", "output": "(defmacro DEFMETHOD ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(with-local-class-registry nil)\n\nWhat needs to change: Macro call that should be transformed by WITH-LOCAL-CLASS-REGISTRY", "input": "(with-local-class-registry nil)", "output": "(defmacro with-local-class-registry ((&key inherit) &body body)\n \"Run BODY in a dynamic environment where *CLASS-REGISTRY* is a\ntemporary local list. If :INHERIT is non-null, the local registry\nshall initially have the same content as the exterior *CLASS-REGISTRY*, \notherwise it shall be NIL.\"\n `(let ((*class-registry*\n ,(if inherit\n `(copy-alist\n ,(if (eql inherit t) '*class-registry* inherit)))))\n ,@body))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(setypecase nil\n nil)\n\nIssue: Macro call that should be transformed by SETYPECASE", "input": "(setypecase nil\n nil)", "output": "(defmacro setypecase (keyform &body cases)\n \"Like ETYPECASE, except binds the keyform to IT (via SYMBOL-MACROLET) for\nthe scope of the cases. IT can be set with SETF.\"\n `(symbolic etypecase ,keyform ,@cases))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(undefreply nil (progn))\n\nWhat needs to change: Macro call that should be transformed by UNDEFREPLY", "input": "(undefreply nil (progn))", "output": "(defmacro UNDEFREPLY ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(ps-once-only nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by PS-ONCE-ONLY", "input": "(ps-once-only nil\n :key\n nil)", "output": "(defmacro PS-ONCE-ONLY ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(custom-decoder)\n\nIssue: Macro call that should be transformed by CUSTOM-DECODER", "input": "(custom-decoder)", "output": "(defmacro custom-decoder (&rest customizations)\n \"Return a function which is like DECODE-JSON called in a dynamic\nenvironment with the given CUSTOMIZATIONS.\"\n `(lambda (&optional (stream *json-input*))\n (bind-custom-vars ,customizations\n (decode-json stream))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(ap nil (progn))\n\nWhat needs to change: Macro call that should be transformed by AP", "input": "(ap nil (progn))", "output": "(defmacro ap (f parser &rest parsers)\n \"Run many parsers that must all succeed, and apply their success values to a\ngiven lambda. More memory-efficient than the combination of `<*>' and `fmap'.\"\n (let ((offset (gensym \"ap-OFFSET\"))\n (final (gensym \"ap-FINAL\")))\n `(lambda (,offset)\n ,(labels ((recurse (ps rs i)\n (if (null ps)\n (let ((ordered (nreverse rs)))\n ;; NOTE: 2025-10-20 This final check allows the user to\n ;; yield `:fail' from within the passed lambda as well.\n ;; It will be detected here and the failure offset will\n ;; be set to the original offset, not the last one it\n ;; got to. Overall this improves error reporting, as\n ;; there was already nothing preventing the user from\n ;; yielding `:fail' anyway.\n `(let ((,final (funcall ,f ,@ordered)))\n (if (failure? ,final)\n (fail ,offset)\n (values ,final ,i))))\n (let ((res (gensym \"ap-RES\"))\n (next (gensym \"ap-NEXT\")))\n `(multiple-value-bind (,res ,next) (funcall ,(car ps) ,i)\n (if (failure? ,res)\n (fail ,next)\n ,(recurse (cdr ps) (cons res rs) next)))))))\n (recurse (cons parser parsers) '() offset)))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "advanced", "quality_score": 0.8099999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(defmacro-driver 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by DEFMACRO-DRIVER", "input": "(defmacro-driver 'lol-gen::some-name)", "output": "(defmacro defmacro-driver (clause-template &body body)\n \"Create iterators which may also be used as generators\"\n (define-clause 'defmacro clause-template body t))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8374999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(query-dao nil nil)\n\nProblem: Macro call that should be transformed by QUERY-DAO", "input": "(query-dao nil nil)", "output": "(defmacro query-dao (type query &rest args)\n \"Execute the given query (which can be either a string or an S-SQL expression)\nand return the result as DAOs of the given type. If the query contains\nplaceholders ($1, $2, etc) their values can be given as extra arguments. The\nnames of the fields returned by the query must either match slots in the DAO\nclass, or be bound through with-column-writers.\"\n `(query-dao% ,type ,(real-query query) (dao-row-reader (find-class ,type)) ,@args))", "category": "dsl", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.885}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with-savepoint 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by WITH-SAVEPOINT", "input": "(with-savepoint 'lol-gen::some-name)", "output": "(defmacro with-savepoint (conn &body body)\n (let ((ok (gensym \"SAVEPOINT-OK\"))\n (state-var (gensym \"STATE-VAR\"))\n (ident-var (gensym \"SAVEPOINT-IDENTIFIER-VAR\")))\n `(let* ((,state-var (make-instance 'savepoint-state\n :conn ,conn))\n (,ident-var (get-identifier ,state-var))\n (*transaction-state*\n (cons ,state-var\n *transaction-state*))\n ,ok)\n\n (savepoint ,conn ,ident-var)\n (unwind-protect\n (multiple-value-prog1\n (progn ,@body)\n (setf ,ok t))\n (when (eql (get-state ,state-var)\n :in-progress)\n (if ,ok\n (release-savepoint ,conn ,ident-var)\n (rollback-savepoint ,conn ,ident-var)))))))", "category": "dsl", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Generate a defmacro form that transforms code like this:\n(define-declaration nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by DEFINE-DECLARATION", "input": "(define-declaration nil\n nil)", "output": "(defmacro DEFINE-DECLARATION ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(dlet nil\n nil)\n\nProblem: Macro call that should be transformed by DLET", "input": "(dlet nil\n nil)", "output": "(defmacro DLET ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-live-scope\n nil)\n\nIssue: Macro call that should be transformed by WITH-LIVE-SCOPE", "input": "(with-live-scope\n nil)", "output": "(defmacro with-live-scope (&body body)\n \"Stop all live blocks defined in BODY on exiting the form.\n\nAll live blocks, defined using LIVE, are stopped when exiting the\ndynamic extent defined by this form.\n\nMultiple WITH-LIVE-SCOPE forms can be nested, in which case each form\nstops the live blocks defined immediately within it.\"\n\n (with-gensyms (stoppers forms global-live)\n `(let ((,stoppers nil))\n (macrolet ((,global-live (&body ,forms)\n (macroexpand `(live ,@,forms)))\n\n (live (&body ,forms)\n `(push (,',global-live ,@,forms) ,',stoppers)))\n (unwind-protect (progn ,@body)\n (foreach #'funcall ,stoppers))))))", "category": "anaphoric", "technique": "macrolet,gensym,anaphor", "complexity": "intermediate", "quality_score": 0.81}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(call-method 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by CALL-METHOD", "input": "(call-method 'lol-gen::some-name)", "output": "(defmacro CALL-METHOD ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(export-class)\n\nPattern to recognize: Macro call that should be transformed by EXPORT-CLASS", "input": "(export-class)", "output": "(defmacro EXPORT-CLASS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(dynamic-relet* nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by DYNAMIC-RELET*", "input": "(dynamic-relet* nil\n nil)", "output": "(defmacro DYNAMIC-RELET* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(prog ())\n\nIssue: Macro call that should be transformed by PROG", "input": "(prog ())", "output": "(defmacro PROG ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(ctypecase-of nil\n (progn))\n\nProblem: Macro call that should be transformed by CTYPECASE-OF", "input": "(ctypecase-of nil\n (progn))", "output": "(defmacro ctypecase-of (type keyplace &body body &environment env)\n \"Like `etypecase-of', but providing a `store-value' restart to correct KEYPLACE and try again.\"\n (check-exhaustiveness 'typecase type body env)\n `(ctypecase ,keyplace ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(declaration 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by DECLARATION", "input": "(declaration 'lol-gen::some-name)", "output": "(defmacro DECLARATION ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with nil nil)\n\nWrite a macro that addresses: Macro call that should be transformed by WITH", "input": "(with nil nil)", "output": "(defmacro WITH ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(xor nil nil)\n\nProblem: Macro call that should be transformed by XOR", "input": "(xor nil nil)", "output": "(defmacro xor (&rest args)\n \"Evaluates the ARGS one at a time. If more than one is T,\n evaluation stops and NIL is returned. If exactly one arg is T,\n that value is returned.\"\n (let ((state (gensym \"XOR-state-\"))\n (block-name (gensym \"XOR-block-\"))\n (arg-temp (gensym \"XOR-arg-temp-\")))\n `(let (,state\n ,arg-temp)\n (block ,block-name\n ,@(loop\n :for arg :in args\n :collect `(setf ,arg-temp ,arg)\n :collect `(when ,arg-temp\n ;; arg is T, this can change the state\n (if ,state\n ;; a second T value, return NIL\n (return-from ,block-name nil)\n ;; a first T, swap the state\n (setf ,state ,arg-temp))))\n (return-from ,block-name ,state)))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "intermediate", "quality_score": 0.7975}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(nand)\n\nProblem: Macro call that should be transformed by NAND", "input": "(nand)", "output": "(defmacro nand (&rest forms)\n \"Equivalent to (not (and ...)).\"\n (if (null forms) nil\n (if (null (rest forms))\n `(not ,(first forms))\n `(if ,(first forms)\n (nand ,@(rest forms))\n t))))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.815}
{"instruction": "Generate a defmacro form that transforms code like this:\n(in-compile-time nil\n :key\n nil)\n\nPattern to recognize: Macro call that should be transformed by IN-COMPILE-TIME", "input": "(in-compile-time nil\n :key\n nil)", "output": "(defmacro IN-COMPILE-TIME ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(lambda () (progn))\n\nProblem: Macro call that should be transformed by LAMBDA", "input": "(lambda () (progn))", "output": "(defmacro LAMBDA ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(awhen nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by AWHEN", "input": "(awhen nil\n (progn))", "output": "(defmacro awhen (test &body body)\n \"Like WHEN, except binds the result of the test to IT (via LET) for the scope\nof the body.\"\n `(anaphoric when ,test ,@body))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(defreply nil\n :key\n nil)\n\nPattern to recognize: Macro call that should be transformed by DEFREPLY", "input": "(defreply nil\n :key\n nil)", "output": "(defmacro DEFREPLY ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(c?_\n nil\n nil)\n\nProblem: Macro call that should be transformed by C?_", "input": "(c?_\n nil\n nil)", "output": "(defmacro c?_ (&body body)\n `(make-c-dependent\n :code ',body\n :value-state :unevaluated\n :lazy t\n :rule (c-lambda ,@body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(deftest nil\n :key\n nil)\n\nProblem: Macro call that should be transformed by DEFTEST", "input": "(deftest nil\n :key\n nil)", "output": "(defmacro deftest (name &body test-forms)\n (let ((tests (gensym \"TESTS\"))\n (test (gensym \"TEST\"))\n (test-fn (gensym \"TEST-FN\")))\n `(progn\n (unless (nth-value 1 (gethash *package* *package-tests*))\n (setf (gethash *package* *package-tests*) '()))\n (let* ((,tests (gethash *package* *package-tests*))\n (,test (assoc ',name ,tests :test #'string=))\n (,test-fn (lambda ()\n (subtest (princ-to-string ',name)\n ,@test-forms))))\n (if ,test\n (rplacd ,test ,test-fn)\n (push (cons ',name ,test-fn) (gethash *package* *package-tests*)))\n ',name))))", "category": "control-flow", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Generate a defmacro form that transforms code like this:\n(walk-environment/augment! nil :key nil)\n\nPattern to recognize: Macro call that should be transformed by WALK-ENVIRONMENT/AUGMENT!", "input": "(walk-environment/augment! nil :key nil)", "output": "(defmacro WALK-ENVIRONMENT/AUGMENT! ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(product-of nil)\n\nWrite a macro that addresses: Macro call that should be transformed by PRODUCT-OF", "input": "(product-of nil)", "output": "(defmacro PRODUCT-OF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(dlet nil\n :key\n nil)\n\nIssue: Macro call that should be transformed by DLET", "input": "(dlet nil\n :key\n nil)", "output": "(defmacro DLET ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(nconcf nil)\n\nWhat needs to change: Macro call that should be transformed by NCONCF", "input": "(nconcf nil)", "output": "(defmacro NCONCF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(aif nil nil)\n\nWrite a macro that addresses: Macro call that should be transformed by AIF", "input": "(aif nil nil)", "output": "(defmacro aif (test then &optional else)\n \"Like IF, except binds the result of the test to IT (via LET) for\nthe scope of the then and else expressions.\" \n `(anaphoric if ,test ,then ,else))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(defmethod* 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by DEFMETHOD*", "input": "(defmethod* 'lol-gen::some-name)", "output": "(defmacro DEFMETHOD* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(ap nil :key nil)\n\nWrite a macro that addresses: Macro call that should be transformed by AP", "input": "(ap nil :key nil)", "output": "(defmacro ap (f parser &rest parsers)\n \"Run many parsers that must all succeed, and apply their success values to a\ngiven lambda. More memory-efficient than the combination of `<*>' and `fmap'.\"\n (let ((offset (gensym \"ap-OFFSET\"))\n (final (gensym \"ap-FINAL\")))\n `(lambda (,offset)\n ,(labels ((recurse (ps rs i)\n (if (null ps)\n (let ((ordered (nreverse rs)))\n ;; NOTE: 2025-10-20 This final check allows the user to\n ;; yield `:fail' from within the passed lambda as well.\n ;; It will be detected here and the failure offset will\n ;; be set to the original offset, not the last one it\n ;; got to. Overall this improves error reporting, as\n ;; there was already nothing preventing the user from\n ;; yielding `:fail' anyway.\n `(let ((,final (funcall ,f ,@ordered)))\n (if (failure? ,final)\n (fail ,offset)\n (values ,final ,i))))\n (let ((res (gensym \"ap-RES\"))\n (next (gensym \"ap-NEXT\")))\n `(multiple-value-bind (,res ,next) (funcall ,(car ps) ,i)\n (if (failure? ,res)\n (fail ,next)\n ,(recurse (cdr ps) (cons res rs) next)))))))\n (recurse (cons parser parsers) '() offset)))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "advanced", "quality_score": 0.8099999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(where 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by WHERE", "input": "(where 'lol-gen::some-name)", "output": "(defmacro WHERE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(rem-plist-val! nil (progn))\n\nProblem: Macro call that should be transformed by REM-PLIST-VAL!", "input": "(rem-plist-val! nil (progn))", "output": "(defmacro rem-plist-val! (id place &key (test '(default-test)) (key '(default-key)))\n `(setf ,place\n (rem-plist-val ,id ,place :test ,test :key ,key)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(eval-always\n common-lisp:nil\n (common-lisp:progn))\n\nIssue: Macro call that should be transformed by EVAL-ALWAYS", "input": "(eval-always\n common-lisp:nil\n (common-lisp:progn))", "output": "(defmacro EVAL-ALWAYS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8049999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(jand nil)\n\nPattern to recognize: Macro call that should be transformed by JAND", "input": "(jand nil)", "output": "(defmacro jand (&rest args)\n \"JSON-aware version of `cl:and'.\"\n `(and ,@(loop for arg in args\n collecting `(jwhen ,arg ,arg))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(true nil (progn))\n\nPattern to recognize: Macro call that should be transformed by TRUE", "input": "(true nil (progn))", "output": "(defmacro true (form &optional description &rest format-args)\n `(eval-in-context\n *context*\n (make-instance 'comparison-result\n :expression '(true ,form)\n :value-form ',form\n :body (lambda () ,form)\n :expected 'T\n :comparison 'geq\n ,@(when description\n `(:description (format NIL ,description ,@format-args))))))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.885}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(deftable nil\n (progn))\n\nWhat needs to change: Macro call that should be transformed by DEFTABLE", "input": "(deftable nil\n (progn))", "output": "(defmacro deftable (name &body definitions)\n \"Define a table. name can be either a symbol or a (symbol string) list. In the\nfirst case, the table name is derived from the symbol by S-SQL's rules, in the\nsecond case, the name is given explicitly. The body of definitions can contain\nanything that evaluates to a string, as well as S-SQL expressions. In this body,\nthe variables *table-name* and *table-symbol* are bound to the relevant values.\nNote that the evaluation of the definition is ordered, so you will generally\nwant to create your table first and then define indices on it.\"\n (multiple-value-bind (symbol name)\n (if (consp name) (values-list name) (values name (to-sql-name name nil)))\n (flet ((check-s-sql (form)\n (if (and (consp form) (keywordp (car form))) (list 'sql form) form)))\n `(add-table-definition\n ',symbol\n (lambda ()\n (let ((*table-name* ,name) (*table-symbol* ',symbol))\n (dolist (stat (list ,@(mapcar #'check-s-sql definitions)))\n (execute stat))))))))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(->> 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by ->>", "input": "(->> 'lol-gen::some-name)", "output": "(defmacro ->> (init &body exps) (arrow-macro init exps t))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-yield\n 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by WITH-YIELD", "input": "(with-yield\n 'lol-gen::some-name)", "output": "(defmacro with-yield (&body body)\n (let ((point (gensym))\n (current (gensym)))\n `(let (,point ,current)\n (with-call/cc\n\t (labels ((yield (&rest values)\n\t\t (setf ,current values)\n\t\t (let/cc k\n\t\t (setf ,point k))))\n\t ,@body\n\t (setf ,point nil)))\n (gen-lambda ()\n\t (cond ((null ,point)\n\t\t'generator-stop)\n\t (t\n\t\t(let ((current ,current))\n\t\t (funcall ,point nil)\n\t\t ;values-handler: see gen-lambda\n\t\t (apply #'values (funcall values-handler current)))))))))", "category": "dsl", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(defsubst nil\n nil)\n\nProblem: Macro call that should be transformed by DEFSUBST", "input": "(defsubst nil\n nil)", "output": "(defmacro defsubst (name params &body body)\n \"Define an inline function.\n\n (defsubst fn ...)\n \u2261 (declaim (inline fn))\n (defun fn ...)\n\nThe advantage of a separate defining form for inline functions is that\nyou can't forget to declaim the function inline before defining it \u2013\nwithout which it may not actually end up being inlined.\n\nFrom Emacs and other ancient Lisps.\"\n `(progn\n (declaim (inline ,name))\n (defun ,name ,params\n ,@body)))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Generate a defmacro form that transforms code like this:\n(cond-<>>\n nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by COND-<>>", "input": "(cond-<>>\n nil\n nil)", "output": "(defmacro COND-<>> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(econd-let 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by ECOND-LET", "input": "(econd-let 'lol-gen::some-name)", "output": "(defmacro econd-let (symbol &body clauses)\n \"Like `cond-let' for `econd'.\"\n `(cond-let ,symbol\n ,@clauses\n (t (error 'econd-failure))))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(local\n nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by LOCAL", "input": "(local\n nil\n :key\n nil)", "output": "(defmacro local (&body orig-body &environment env)\n \"Make internal definitions using top-level definition forms.\n\nWithin `local' you can use top-level definition forms and have them\ncreate purely local definitions, like `let', `labels', and `macrolet':\n\n (fboundp 'plus) ; => nil\n\n (local\n (defun plus (x y)\n (+ x y))\n (plus 2 2))\n ;; => 4\n\n (fboundp 'plus) ; => nil\n\nEach form in BODY is subjected to partial expansion (with\n`macroexpand-1') until either it expands into a recognized definition\nform (like `defun') or it can be expanded no further.\n\n\\(This means that you can use macros that expand into top-level\ndefinition forms to create local definitions.)\n\nJust as at the real top level, a form that expands into `progn' (or an\nequivalent `eval-when') is descended into, and definitions that occur\nwithin it are treated as top-level definitions.\n\n\\(Support for `eval-when' is incomplete: `eval-when' is supported only\nwhen it is equivalent to `progn').\n\nThe recognized definition forms are:\n\n- `def', for lexical variables (as with `letrec')\n- `define-values', for multiple lexical variables at once\n- `defun', for local functions (as with `labels')\n- `defalias', to bind values in the function namespace (like `fbindrec*')\n- `declaim', to make declarations (as with `declare')\n- `defconstant' and `defconst', which behave exactly like symbol macros\n- `define-symbol-macro', to bind symbol macros (as with `symbol-macrolet')\n\nAlso, with serious restrictions, you can use:\n\n- `defmacro', for local macros (as with `macrolet')\n\n\\(Note that the top-level definition forms defined by Common Lisp\nare (necessarily) supplemented by three from Serapeum: `def',\n`define-values', and `defalias'.)\n\nThe exact order in which the bindings are made depends on how `local'\nis implemented at the time you read this. The only guarantees are that\nvariables are bound sequentially; functions can always close over the\nbindings of variables, and over other functions; and macros can be\nused once they are defined.\n\n (local\n (def x 1)\n (def y (1+ x))\n y)\n => 2\n\n (local\n (defun adder (y)\n (+ x y))\n (def x 2)\n (adder 1))\n => 3\n\nPerhaps surprisingly, `let' forms (as well as `let*' and\n`multiple-value-bind') *are* descended into; the only difference is\nthat `defun' is implicitly translated into `defalias'. This means you\ncan use the top-level idiom of wrapping `let' around `defun'.\n\n (local\n (let ((x 2))\n (defun adder (y)\n (+ x y)))\n (adder 2))\n => 4\n\nSupport for macros is sharply limited. (Symbol macros, on the other\nhand, are completely supported.)\n\n1. Macros defined with `defmacro' must precede all other expressions.\n\n2. Macros cannot be defined inside of binding forms like `let'.\n\n3. `macrolet' is not allowed at the top level of a `local' form.\n\nThese restrictions are undesirable, but well justified: it is\nimpossible to handle the general case both correctly and portably, and\nwhile some special cases could be provided for, the cost in complexity\nof implementation and maintenance would be prohibitive.\n\nThe value returned by the `local' form is that of the last form in\nBODY. Note that definitions have return values in `local' just like\nthey do at the top level. For example:\n\n (local\n (plus 2 2)\n (defun plus (x y)\n (+ x y)))\n\nReturns `plus', not 4.\n\nThe `local' macro is loosely based on Racket's support for internal\ndefinitions.\"\n (multiple-value-bind (body decls) (parse-body orig-body)\n (catch 'local\n (generate-internal-definitions\n (make 'internal-definitions-env\n :decls decls\n :env env)\n body))))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Generate a defmacro form that transforms code like this:\n(as-> nil (progn))\n\nPattern to recognize: Macro call that should be transformed by AS->", "input": "(as-> nil (progn))", "output": "(defmacro AS-> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(query nil nil)\n\nWhat needs to change: Macro call that should be transformed by QUERY", "input": "(query nil nil)", "output": "(defmacro query (query &rest args/format)\n \"Execute the given query, which can be either a string or an S-SQL form (list\nstarting with a keyword). If the query contains placeholders ($1, $2, etc)\ntheir values can be given as extra arguments. If one of these arguments is a\nkeyword occurring in the table below, it will not be used as a query\nargument, but will determine the format in which the results are returned\ninstead. Any of the following formats can be used, with the default being :rows:\n\n| :none\t | Ignore the result values. |\n| :lists, :rows | Return a list of lists, each list containing the values |\n| | for a row. |\n| :list, :row | Return a single row as a list. |\n| :alists\t | Return a list of alists which map column names to values, |\n| | with the names represented as keywords. |\n| :alist\t | Return a single row as an alist. |\n| :array-hash | Return an array of hashtables which map column names to |\n| | hash table keys. NOTE: It will return an empty array |\n| | if there is no result. |\n| :vectors | Returns a vector of vectors where each internal vector is |\n| | a returned row from the query. The field names are not |\n| | included. NOTE: It will return an empty vector instead of |\n| | NIL if there is no result. |\n| :str-alists | Like :alists, but use the original column names. |\n| :str-alist\t | Return a single row as an alist, with strings for names. |\n| :plists\t | Return a list of plists which map column names to values, |\n| | with the names represented as keywords. |\n| :plist\t | Return a single row as a plist. |\n| :column\t | Return a single column as a list. |\n| :single\t | Return a single value. |\n| :single!\t | Like :single, but raise an error when the number of |\n| | selected rows is not equal to 1. |\n| (:dao type)\t | Return a list of DAOs of the given type. The names of the |\n| | fields returned by the query must match slots in the DAO |\n| | class the same way as with query-dao. |\n| (:dao type :single)| Return a single DAO of the given type. |\n| :json-strs | Return a list of strings where each row is a json object |\n| | expressed as a string |\n| :json-str | Return a single string where the row returned is a json |\n| | object expressed as a string. |\n| :json-array-str | Return a string containing a json array, each element in |\n| | the array is a selected row expressed as a json object. |\n| | NOTE: If there is no result, it will return a string with |\n| | an empty json array. |\n\nIf the database returns information about the amount rows that were affected,\nsuch as with updating or deleting queries, this is returned as a second value.\"\n (let* ((format :rows)\n (args (loop :for arg :in args/format\n :if (or (dao-spec-for-format arg)\n (assoc arg *result-styles*)) :do (setf format arg)\n :else :collect arg)))\n (destructuring-bind (reader result-form) (reader-for-format format)\n (let ((base (if args\n\t\t (let ((vars (loop :for x :in args :collect (gensym))))\n\t\t\t`(let ,(loop :for v :in vars :for a :in args :collect `(,v ,a))\n\t\t\t (prepare-query *database* \"\" ,(real-query query) (list ,@vars))\n\t\t\t (exec-prepared *database* \"\" (list ,@vars) ,reader)))\n\t\t `(exec-query *database* ,(real-query query) ,reader))))\n `(,result-form ,base)))))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.835}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(multiple-value-match nil)\n\nWrite a macro that addresses: Macro call that should be transformed by MULTIPLE-VALUE-MATCH", "input": "(multiple-value-match nil)", "output": "(defmacro multiple-value-match (values-form &body clauses)\n \"Matches the multiple values of VALUES-FORM with CLAUSES. Unlike\nMATCH, CLAUSES have to have the form of (PATTERNS . BODY), where\nPATTERNS is a list of patterns. The number of values that will be used\nto match is determined by the maximum arity of PATTERNS among CLAUSES.\n\nExamples:\n\n (multiple-value-match (values 1 2)\n ((2) 1)\n ((1 y) y))\n => 2\"\n (compile-multiple-value-match values-form clauses nil))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.885}
{"instruction": "Generate a defmacro form that transforms code like this:\n(nunionf nil :key nil)\n\nPattern to recognize: Macro call that should be transformed by NUNIONF", "input": "(nunionf nil :key nil)", "output": "(defmacro NUNIONF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(with-yield\n nil)\n\nProblem: Macro call that should be transformed by WITH-YIELD", "input": "(with-yield\n nil)", "output": "(defmacro with-yield (&body body)\n (let ((point (gensym))\n (current (gensym)))\n `(let (,point ,current)\n (with-call/cc\n\t (labels ((yield (&rest values)\n\t\t (setf ,current values)\n\t\t (let/cc k\n\t\t (setf ,point k))))\n\t ,@body\n\t (setf ,point nil)))\n (gen-lambda ()\n\t (cond ((null ,point)\n\t\t'generator-stop)\n\t (t\n\t\t(let ((current ,current))\n\t\t (funcall ,point nil)\n\t\t ;values-handler: see gen-lambda\n\t\t (apply #'values (funcall values-handler current)))))))))", "category": "dsl", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(query nil)\n\nWrite a macro that addresses: Macro call that should be transformed by QUERY", "input": "(query nil)", "output": "(defmacro query (query &rest args/format)\n \"Execute the given query, which can be either a string or an S-SQL form (list\nstarting with a keyword). If the query contains placeholders ($1, $2, etc)\ntheir values can be given as extra arguments. If one of these arguments is a\nkeyword occurring in the table below, it will not be used as a query\nargument, but will determine the format in which the results are returned\ninstead. Any of the following formats can be used, with the default being :rows:\n\n| :none\t | Ignore the result values. |\n| :lists, :rows | Return a list of lists, each list containing the values |\n| | for a row. |\n| :list, :row | Return a single row as a list. |\n| :alists\t | Return a list of alists which map column names to values, |\n| | with the names represented as keywords. |\n| :alist\t | Return a single row as an alist. |\n| :array-hash | Return an array of hashtables which map column names to |\n| | hash table keys. NOTE: It will return an empty array |\n| | if there is no result. |\n| :vectors | Returns a vector of vectors where each internal vector is |\n| | a returned row from the query. The field names are not |\n| | included. NOTE: It will return an empty vector instead of |\n| | NIL if there is no result. |\n| :str-alists | Like :alists, but use the original column names. |\n| :str-alist\t | Return a single row as an alist, with strings for names. |\n| :plists\t | Return a list of plists which map column names to values, |\n| | with the names represented as keywords. |\n| :plist\t | Return a single row as a plist. |\n| :column\t | Return a single column as a list. |\n| :single\t | Return a single value. |\n| :single!\t | Like :single, but raise an error when the number of |\n| | selected rows is not equal to 1. |\n| (:dao type)\t | Return a list of DAOs of the given type. The names of the |\n| | fields returned by the query must match slots in the DAO |\n| | class the same way as with query-dao. |\n| (:dao type :single)| Return a single DAO of the given type. |\n| :json-strs | Return a list of strings where each row is a json object |\n| | expressed as a string |\n| :json-str | Return a single string where the row returned is a json |\n| | object expressed as a string. |\n| :json-array-str | Return a string containing a json array, each element in |\n| | the array is a selected row expressed as a json object. |\n| | NOTE: If there is no result, it will return a string with |\n| | an empty json array. |\n\nIf the database returns information about the amount rows that were affected,\nsuch as with updating or deleting queries, this is returned as a second value.\"\n (let* ((format :rows)\n (args (loop :for arg :in args/format\n :if (or (dao-spec-for-format arg)\n (assoc arg *result-styles*)) :do (setf format arg)\n :else :collect arg)))\n (destructuring-bind (reader result-form) (reader-for-format format)\n (let ((base (if args\n\t\t (let ((vars (loop :for x :in args :collect (gensym))))\n\t\t\t`(let ,(loop :for v :in vars :for a :in args :collect `(,v ,a))\n\t\t\t (prepare-query *database* \"\" ,(real-query query) (list ,@vars))\n\t\t\t (exec-prepared *database* \"\" (list ,@vars) ,reader)))\n\t\t `(exec-query *database* ,(real-query query) ,reader))))\n `(,result-form ,base)))))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.835}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(product-of nil\n :key\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by PRODUCT-OF", "input": "(product-of nil\n :key\n nil)", "output": "(defmacro PRODUCT-OF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(with-decoder-simple-clos-semantics\n nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by WITH-DECODER-SIMPLE-CLOS-SEMANTICS", "input": "(with-decoder-simple-clos-semantics\n nil\n nil)", "output": "(defmacro with-decoder-simple-clos-semantics (&body body)\n \"Execute BODY in a dynamic environement where the decoder semantics\nis such as set by SET-DECODER-SIMPLE-CLOS-SEMANTICS.\"\n `(with-shadowed-custom-vars\n (set-decoder-simple-clos-semantics)\n ,@body))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(with-savepoint nil)\n\nWhat needs to change: Macro call that should be transformed by WITH-SAVEPOINT", "input": "(with-savepoint nil)", "output": "(defmacro with-savepoint (conn &body body)\n (let ((ok (gensym \"SAVEPOINT-OK\"))\n (state-var (gensym \"STATE-VAR\"))\n (ident-var (gensym \"SAVEPOINT-IDENTIFIER-VAR\")))\n `(let* ((,state-var (make-instance 'savepoint-state\n :conn ,conn))\n (,ident-var (get-identifier ,state-var))\n (*transaction-state*\n (cons ,state-var\n *transaction-state*))\n ,ok)\n\n (savepoint ,conn ,ident-var)\n (unwind-protect\n (multiple-value-prog1\n (progn ,@body)\n (setf ,ok t))\n (when (eql (get-state ,state-var)\n :in-progress)\n (if ,ok\n (release-savepoint ,conn ,ident-var)\n (rollback-savepoint ,conn ,ident-var)))))))", "category": "dsl", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(some-> nil)\n\nIssue: Macro call that should be transformed by SOME->", "input": "(some-> nil)", "output": "(defmacro SOME-> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(->> 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by ->>", "input": "(->> 'lol-gen::some-name)", "output": "(defmacro ->> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(defproto 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by DEFPROTO", "input": "(defproto 'lol-gen::some-name)", "output": "(defmacro DEFPROTO ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(with-foreign-strings nil\n :key\n nil)\n\nPattern to recognize: Macro call that should be transformed by WITH-FOREIGN-STRINGS", "input": "(with-foreign-strings nil\n :key\n nil)", "output": "(defmacro with-foreign-strings (bindings &body body)\n \"See WITH-FOREIGN-STRING's documentation.\"\n (if bindings\n `(with-foreign-string ,(first bindings)\n (with-foreign-strings ,(rest bindings)\n ,@body))\n `(progn ,@body)))", "category": "dsl", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.8999999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(defclause nil\n :key\n nil)\n\nPattern to recognize: Macro call that should be transformed by DEFCLAUSE", "input": "(defclause nil\n :key\n nil)", "output": "(defmacro defclause (name arglist &body body)\n \"Same as cl:defmacro, but additionally records <name> in *clauses* as a known clause macro.\"\n `(progn\n (defmacro ,name ,arglist ,@body)\n (pushnew ',name *clauses*)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(rotatef nil (progn))\n\nWhat needs to change: Macro call that should be transformed by ROTATEF", "input": "(rotatef nil (progn))", "output": "(defmacro ROTATEF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with-decoder-simple-clos-semantics)\n\nWrite a macro that addresses: Macro call that should be transformed by WITH-DECODER-SIMPLE-CLOS-SEMANTICS", "input": "(with-decoder-simple-clos-semantics)", "output": "(defmacro with-decoder-simple-clos-semantics (&body body)\n \"Execute BODY in a dynamic environement where the decoder semantics\nis such as set by SET-DECODER-SIMPLE-CLOS-SEMANTICS.\"\n `(with-shadowed-custom-vars\n (set-decoder-simple-clos-semantics)\n ,@body))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(in-suite nil)\n\nProblem: Macro call that should be transformed by IN-SUITE", "input": "(in-suite nil)", "output": "(defmacro in-suite (suite-name)\n \"Set the *suite* special variable so that all tests defined\nafter the execution of this form are, unless specified otherwise,\nin the test-suite named SUITE-NAME.\n\nSee also: DEF-SUITE *SUITE*\"\n `(eval-when (:compile-toplevel :load-toplevel :execute)\n (%in-suite ,suite-name)))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(call-method nil (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by CALL-METHOD", "input": "(call-method nil (progn))", "output": "(defmacro CALL-METHOD ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(ignore-errors nil (progn))\n\nProblem: Macro call that should be transformed by IGNORE-ERRORS", "input": "(ignore-errors nil (progn))", "output": "(defmacro IGNORE-ERRORS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(dynamic-let nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by DYNAMIC-LET", "input": "(dynamic-let nil\n nil)", "output": "(defmacro DYNAMIC-LET ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(deletef nil :key nil)\n\nIssue: Macro call that should be transformed by DELETEF", "input": "(deletef nil :key nil)", "output": "(defmacro DELETEF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(dynamic-wind)\n\nIssue: Macro call that should be transformed by DYNAMIC-WIND", "input": "(dynamic-wind)", "output": "(defmacro DYNAMIC-WIND ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(defmethod* nil\n nil)\n\nWhat needs to change: Macro call that should be transformed by DEFMETHOD*", "input": "(defmethod* nil\n nil)", "output": "(defmacro DEFMETHOD* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(and-let* nil\n nil)\n\nIssue: Macro call that should be transformed by AND-LET*", "input": "(and-let* nil\n nil)", "output": "(defmacro and-let* ((&rest clauses) &body body &environment env)\n \"Scheme's guarded LET* (SRFI-2).\n\nEach clause should have one of the following forms:\n\n- `identifier', in which case IDENTIFIER's value is tested.\n\n- `(expression)', in which case the value of EXPRESSION is tested.\n\n- `(identifier expression)' in which case EXPRESSION is evaluated,\n and, if its value is not false, IDENTIFIER is bound to that value\n for the remainder of the clauses and the optional body.\n\nNote that, of course, the semantics are slightly different in Common\nLisp than in Scheme, because our AND short-circuits on null, not\nfalse.\n\nAlso, this version makes the bindings immutable.\"\n (multiple-value-bind (body decls)\n (parse-body body)\n (labels ((expand (clauses body)\n (unsplice\n (ematch clauses\n (() (if body `(progn ,@body) nil))\n ((list* (and var (type symbol)) clauses)\n `(and ,var ,@(expand clauses body)))\n ((list* (list var expr) clauses)\n (let ((temp (gensym (string var))))\n (multiple-value-bind (local-decls other-decls)\n (partition-declarations (list var) decls env)\n ;; The use of the temporary here is so we still\n ;; get style warnings if the variable is\n ;; unused.\n `(let* ((,temp ,expr)\n (,var ,temp))\n ,@local-decls\n (and ,temp\n ,@(expand clauses\n (append other-decls body)))))))\n ((list* (list expr) clauses)\n `(and ,expr ,@(expand clauses body)))))))\n (car (expand clauses body)))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "intermediate", "quality_score": 0.7975}
{"instruction": "Generate a defmacro form that transforms code like this:\n(inext-or-error nil)\n\nPattern to recognize: Macro call that should be transformed by INEXT-OR-ERROR", "input": "(inext-or-error nil)", "output": "(defmacro INEXT-OR-ERROR ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(collect nil nil)\n\nPattern to recognize: Macro call that should be transformed by COLLECT", "input": "(collect nil nil)", "output": "(defmacro COLLECT ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(validate-superclass*)\n\nIssue: Macro call that should be transformed by VALIDATE-SUPERCLASS*", "input": "(validate-superclass*)", "output": "(defmacro VALIDATE-SUPERCLASS* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(group-by nil :key nil)\n\nWhat needs to change: Macro call that should be transformed by GROUP-BY", "input": "(group-by nil :key nil)", "output": "(defmacro group-by (&rest expressions)\n `(apply #'make-clause :group-by ',expressions))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(for-effects)\n\nProblem: Macro call that should be transformed by FOR-EFFECTS", "input": "(for-effects)", "output": "(defmacro FOR-EFFECTS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(with-iter-value 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by WITH-ITER-VALUE", "input": "(with-iter-value 'lol-gen::some-name)", "output": "(defmacro with-iter-value ((pattern iter) &body body)\n \"Bind the current element of a sequence, pointed to by a static iterator, to a variable.\n\n This macro may only be used within the body of a WITH-ITERATORS\n macro.\n\n The current value of the sequence, with iterator ITER, is bound to\n the variable(s) specified by PATTERN, with the bindings visible to\n FORMS.\n\n If the iterator is already at the end of the sequence a non-local\n jump, to the end of the enclosing WITH-ITERATORS form, is\n performed.\n\n After binding, the iterator is advanced to the next element of the\n sequence.\n\n PATTERN:\n\n A binding pattern specifying the variable(s) to which the current\n element of the sequence is bound.\n\n This may either be a symbol, naming a variable, or a list which\n is interpreted as a pattern to `destructuring-bind`.\n\n ITER:\n\n Symbol identifying the iterator, as established by the\n WITH-ITERATORS form.\n\n This must name an iterator introduced in a parent WITH-ITERATORS\n form.\n\n BODY:\n\n The body of the WITH-ITER-VALUE form:\n\n (DECLARATION* FORM*)\n\n The body consists of a list of forms evaluated in an implicit\n PROGN, with the value of the last form returned from the\n WITH-ITER-VALUE form. The binding(s) introduced by PATTERN are\n visible to forms.\n\n The forms may be preceded by declaration expressions, which may\n apply to the variables introduced in PATTERN.\n\n NOTE: If there are no more elements in the sequence, the forms\n are not evaluated and a non-local jump to the end of the\n enclosing WITH-ITERATORS form is performed.\"\n\n `(with-iter-values ((,pattern ,iter)) ,@body))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.9125}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(send nil :key nil)\n\nProblem: Macro call that should be transformed by SEND", "input": "(send nil :key nil)", "output": "(defmacro SEND ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(try-as common-lisp:nil (common-lisp:progn))\n\nWrite a macro that addresses: Macro call that should be transformed by TRY-AS", "input": "(try-as common-lisp:nil (common-lisp:progn))", "output": "(defmacro try-as (type cl:&optional (expr cl:nil expr-supplied-p))\n \"A syntactic convenience for type casting.\n\n (try-as <type> <expr>)\n\nis equivalent to\n\n (the (Optional <type>) (tryInto <expr>))\n\nand\n\n (try-as <type>)\n\nis equivalent to\n\n (fn (expr) (the (Optional <type>) (tryInto expr))).\n\nNote that this may copy the object or allocate memory.\"\n\n (cl:let ((try-into (cl:ignore-errors (cl:find-symbol \"TRYINTO\" \"COALTON/CLASSES\")))\n (Optional (cl:ignore-errors (cl:find-symbol \"OPTIONAL\" \"COALTON/CLASSES\"))))\n (cl:assert try-into () \"`try-as` macro does not have access to `try-into` yet.\")\n (cl:assert Optional () \"`try-as` macro does not have access to `Optional` yet.\")\n (cl:if expr-supplied-p\n `(the (,Optional ,type) (,try-into ,expr))\n (alexandria:with-gensyms (lexpr)\n `(fn (,lexpr)\n (the (,Optional ,type) (,try-into ,lexpr)))))))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.85}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(some-> nil\n nil)\n\nIssue: Macro call that should be transformed by SOME->", "input": "(some-> nil\n nil)", "output": "(defmacro some-> (init &body exps) (arrow-macro init exps nil t))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(dispatch-case nil)\n\nIssue: Macro call that should be transformed by DISPATCH-CASE", "input": "(dispatch-case nil)", "output": "(defmacro dispatch-case ((&rest exprs-and-types) &body clauses)\n \"Dispatch on the types of multiple expressions, exhaustively.\n\nSay you are working on a project where you need to handle timestamps\nrepresented both as universal times, and as instances of\n`local-time:timestamp'. You start by defining the appropriate types:\n\n (defpackage :dispatch-case-example\n (:use :cl :alexandria :serapeum :local-time)\n (:shadow :time))\n \\(in-package :dispatch-case-example)\n\n (deftype universal-time ()\n '(integer 0 *))\n\n (deftype time ()\n '(or universal-time timestamp))\n\nNow you want to write a `time=' function that works on universal\ntimes, timestamps, and any combination thereof.\n\nYou can do this using `etypecase-of':\n\n (defun time= (t1 t2)\n (etypecase-of time t1\n (universal-time\n (etypecase-of time t2\n (universal-time\n (= t1 t2))\n (timestamp\n (= t1 (timestamp-to-universal t2)))))\n (timestamp\n (etypecase-of time t2\n (universal-time\n (time= t2 t1))\n (timestamp\n (timestamp= t1 t2))))))\n\nThis has the advantage of efficiency and exhaustiveness checking, but\nthe serious disadvantage of being hard to read: to understand what\neach branch matches, you have to backtrack to the enclosing branch.\nThis is bad enough when the nesting is only two layers deep.\n\nAlternately, you could do it with `defgeneric':\n\n (defgeneric time= (t1 t2)\n (:method ((t1 integer) (t2 integer))\n (= t1 t2))\n (:method ((t1 timestamp) (t2 timestamp))\n (timestamp= t1 t2))\n (:method ((t1 integer) (t2 timestamp))\n (= t1 (timestamp-to-universal t2)))\n (:method ((t1 timestamp) (t2 integer))\n (time= t2 t1)))\n\nThis is easy to read, but it has three potential disadvantages. \\(1)\nThere is no exhaustiveness checking. If, at some point in the future,\nyou want to add another representation of time to your project, the\ncompiler will not warn you if you forget to update `time='. \\(This is\nbad enough with only two objects to dispatch on, but with three or\nmore it gets rapidly easier to miss a case.) \\(2) You cannot use the\n`universal-time' type you just defined; it is a type, not a class, so\nyou cannot specialize methods on it. \\(3) You are paying a run-time\nprice for extensibility -- the inherent overhead of a generic function\n-- when extensibility is not what you want.\n\nUsing `dispatch-case' instead gives you the readability of\n`defgeneric' with the efficiency and safety of `etypecase-of'.\n\n (defun time= (t1 t2)\n (dispatch-case ((t1 time)\n (t2 time))\n ((universal-time universal-time)\n (= t1 t2))\n ((timestamp timestamp)\n (timestamp= t1 t2))\n ((universal-time timestamp)\n (= t1 (timestamp-to-universal t2)))\n ((timestamp universal-time)\n (time= t2 t1))))\n\nThe syntax of `dispatch-case' is much closer to `defgeneric' than it\nis to `etypecase'. The order in which clauses are defined does not\nmatter, and you can define fallthrough clauses in the same way you\nwould define fallthrough methods in `defgeneric'.\n\nSuppose you wanted to write a `time=' function like the one above, but\nalways convert times to timestamps before comparing them. You could\nwrite that using `dispatch-case' like so:\n\n (defun time= (x y)\n (dispatch-case ((x time)\n (y time))\n ((* universal-time)\n (time= x (universal-to-timestamp y)))\n ((universal-time *)\n (time= (universal-to-timestamp x) y))\n ((timestamp timestamp)\n (timestamp= x y))))\n\n\\(In the list of types, you can use as asterisk as a shorthand for the\ntype of the corresponding argument to `dispatch-case'; in that above,\n`time'.)\n\nNote that this requires only three clauses, where writing it out using\nnested `etypecase-of' forms would require four clauses. This is a\nsmall gain; but with more subtypes to dispatch on, or more objects,\nsuch fallthrough clauses become more useful.\"\n (let ((*gensym-counter* 0))\n `(dispatch-case-let\n ,(loop for (expr type) in exprs-and-types\n for i from 0\n for var = (string-gensym 'arg)\n collect `((,var ,type) ,expr))\n ,@clauses)))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.835}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(sort-values nil)\n\nProblem: Macro call that should be transformed by SORT-VALUES", "input": "(sort-values nil)", "output": "(defmacro sort-values (pred &rest values)\n \"Sort VALUES with PRED and return as multiple values.\n\nEquivalent to\n\n (values-list (sort (list VALUES...) pred))\n\nBut with less consing, and potentially faster.\"\n ;; Remember to evaluate `pred' no matter what.\n (with-gensyms (gpred)\n `(let ((,gpred (ensure-function ,pred)))\n (declare (ignorable ,gpred)\n (function ,gpred)\n (optimize (safety 1) (debug 0) (compilation-speed 0)))\n ,(match values\n ((list) `(values))\n ((list x) `(values ,x))\n ;; The strategy here is to use a sorting network if the\n ;; inputs are few, and a stack-allocated vector if the\n ;; inputs are many.\n (otherwise\n (if (<= (length values) 8)\n `(sort-values/network ,gpred ,@values)\n `(sort-values/temp-vector ,gpred ,@values)))))))", "category": "capture-management", "technique": "gensym,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(caching-types\n 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by CACHING-TYPES", "input": "(caching-types\n 'lol-gen::some-name)", "output": "(defmacro CACHING-TYPES ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(defgeneric* nil (progn))\n\nPattern to recognize: Macro call that should be transformed by DEFGENERIC*", "input": "(defgeneric* nil (progn))", "output": "(defmacro DEFGENERIC* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(finalize-dispatch-method nil :key nil)\n\nWhat needs to change: Macro call that should be transformed by FINALIZE-DISPATCH-METHOD", "input": "(finalize-dispatch-method nil :key nil)", "output": "(defmacro finalize-dispatch-method (generic-function &rest args)\n \"add a body to the method which dispatched the hooks for the given specialized-lambda-list\nuseful if you wanted to use call-next-method\n\nFor the definition to be effective, it must be defined after every specific hook for the same method hence finalize.\n\nSee defhook\"\n (%destructure-defhook-args args\n (with-effective-qualifier generic-function qualifier\n (destructure-specialized-lambda-list descriptive-lambda-list vanilla-lambda-list type-list specialized-lambda-list\n `(%lay-method-base-for-dispatch ,generic-function ,qualifier ,type-list ,descriptive-lambda-list\n ,@body)))))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(global)\n\nWhat needs to change: Macro call that should be transformed by GLOBAL", "input": "(global)", "output": "(defmacro GLOBAL ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(defrule nil\n (progn))\n\nProblem: Macro call that should be transformed by DEFRULE", "input": "(defrule nil\n (progn))", "output": "(defmacro DEFRULE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(nest 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by NEST", "input": "(nest 'lol-gen::some-name)", "output": "(defmacro nest (&rest things)\n \"Like ~>>, but backward.\n\nThis is useful when layering `with-x' macros where the order is not\nimportant, and extra indentation would be misleading.\n\nFor example:\n\n (nest\n (with-open-file (in file1 :direction input))\n (with-open-file (in file2 :direction output))\n ...)\n\nIs equivalent to:\n\n (with-open-file (in file1 :direction input)\n (with-open-file (in file2 :direction output)\n ...))\n\n\\(But see `with-open-files').\n\nIf the outer macro has no arguments, you may omit the parentheses.\n\n (nest\n with-standard-io-syntax\n ...)\n \u2261 (with-standard-io-syntax\n ...)\n\nFrom UIOP, based on a suggestion by Marco Baringer.\"\n (expand-nest things))", "category": "dsl", "technique": "recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(inext-or-error 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by INEXT-OR-ERROR", "input": "(inext-or-error 'lol-gen::some-name)", "output": "(defmacro INEXT-OR-ERROR ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(c-in-lazy\n 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by C-IN-LAZY", "input": "(c-in-lazy\n 'lol-gen::some-name)", "output": "(defmacro c-in-lazy (&body body)\n `(c-input (:lazy :once-asked) (progn ,@body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(make-name-transformer)\n\nProblem: Macro call that should be transformed by MAKE-NAME-TRANSFORMER", "input": "(make-name-transformer)", "output": "(defmacro make-name-transformer (&rest elements)\n \"Return an accessor name transformer.\nThe unquoted `name' symbol argument is substituted for the slot name.\nClass option examples:\n\n :accessor-name-transformer (make-name-transformer \\\"FOO-\\\" name \\\"-BAR\\\")\n\nUse the slot name directly:\n\n :accessor-name-transformer (make-name-transformer name)\"\n `(lambda (name definition)\n (declare (ignorable definition))\n (concatenate-symbol ,@(mapcar (lambda (el)\n (if (and (symbolp el)\n (string= (symbol-name el) \"NAME\"))\n 'name\n el))\n elements))))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(define-test+run-interactively nil)\n\nWrite a macro that addresses: Macro call that should be transformed by DEFINE-TEST+RUN-INTERACTIVELY", "input": "(define-test+run-interactively nil)", "output": "(defmacro define-test+run-interactively (name &body args-and-body)\n `(progn (define-test ,name ,@args-and-body)\n (eval-when (:execute)\n (values ',name (test ',name :report 'interactive)))))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(doiters nil)\n\nProblem: Macro call that should be transformed by DOITERS", "input": "(doiters nil)", "output": "(defmacro doiters (name/iters &body body)\n \"Iterate over one or more sequences with the iterator of each sequence bound to a variable.\n\n The macro arguments can be in one of the following two forms:\n\n 1. (NAME (&REST ITERS) &BODY BODY)\n\n 2. ((&REST ITERS) &BODY BODY)\n\n\n NAME is a symbol serving as the name of the BLOCK from which the\n forms in BODY can return, using (RETURN-FROM NAME ...). If not\n given defaults to NIL.\n\n ITERS is a list of bindings with each element of the form (IT-VAR\n SEQUENCE . ARGS). IT-VAR is the variable to which the iterator for\n SEQUENCE is bound. ARGS are the remaining arguments passed to the\n ITERATOR function (if any).\n\n BODY is a list of forms which are evaluated at each iteration. The\n bindings to the iterator variables (IT-VAR's) are visible. At the\n end of each iteration, each iterator is advanced by one position\n with ADVANCE. The loop is terminated, with the DOITERS form\n returning NIL, when at least one of the iterators reaches the end\n of its sequence (ENDP returns true). The loop can be terminated\n early with a RETURN-FROM to the block named NAME.\"\n\n (let-if ((name name/iters)\n (iters (first body) name/iters)\n (body (rest body) body))\n (symbolp name/iters)\n\n (flet ((make-it-binding (it)\n\t (destructuring-bind (var &rest args) it\n\t `(,var (iterator ,@args))))\n\n\t (make-end-test (it)\n\t `(endp ,(car it)))\n\n\t (make-advance (it)\n\t `(advance ,(car it))))\n\n `(let ,(mapcar #'make-it-binding iters)\n (loop ,@(when name `(named ,name))\n until (or ,@(mapcar #'make-end-test iters))\n\t do\n\t (progn ,@body)\n\t ,@(mapcar #'make-advance iters))))))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(c-in-lazy\n nil\n nil)\n\nIssue: Macro call that should be transformed by C-IN-LAZY", "input": "(c-in-lazy\n nil\n nil)", "output": "(defmacro c-in-lazy (&body body)\n `(c-input (:lazy :once-asked) (progn ,@body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(when nil :key nil)\n\nProblem: Macro call that should be transformed by WHEN", "input": "(when nil :key nil)", "output": "(defmacro WHEN ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(-<>>\n nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by -<>>", "input": "(-<>>\n nil\n (progn))", "output": "(defmacro -<>> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-access nil\n :key\n nil)\n\nIssue: Macro call that should be transformed by WITH-ACCESS", "input": "(with-access nil\n :key\n nil)", "output": "(defmacro with-access ((&rest keys) val-form &body body)\n \"Similar to with-accessors except using the access functions\"\n (let* ((gval (gensym \"val\"))\n (forms\n (iter (for k in keys)\n (for (k-to k-from) = (if (listp k) k (list k k)))\n (collect `(,k-to (access ,gval ',k-from))))))\n `(let ((,gval ,val-form))\n (declare (ignorable ,gval))\n (symbol-macrolet (,@forms)\n ,@body\n ))))", "category": "dispatch", "technique": "symbol-macrolet,gensym", "complexity": "intermediate", "quality_score": 0.895}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(necessarily?\n nil\n nil)\n\nProblem: Macro call that should be transformed by NECESSARILY?", "input": "(necessarily?\n nil\n nil)", "output": "(defmacro NECESSARILY? ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(for nil\n :key\n nil)\n\nPattern to recognize: Macro call that should be transformed by FOR", "input": "(for nil\n :key\n nil)", "output": "(defmacro for (&environment env bindings &body body)\n (let ((*environment* env))\n (multiple-value-bind (bind-init bind-forms bind-exit bind-post) (convert-bindings bindings)\n (multiple-value-bind (clause-init body-forms clause-exit) (convert-clauses body)\n `(with-interleaving\n ,@bind-init\n ,@clause-init\n (with-for-block ()\n (with-for-tagbody\n (progn ,@bind-forms\n ,@body-forms\n ,@bind-post)\n (return-for\n ,@clause-exit\n ,@bind-exit))))))))", "category": "dsl", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(dynamic-let nil\n (progn))\n\nProblem: Macro call that should be transformed by DYNAMIC-LET", "input": "(dynamic-let nil\n (progn))", "output": "(defmacro DYNAMIC-LET ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(failure? 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by FAILURE?", "input": "(failure? 'lol-gen::some-name)", "output": "(defmacro failure? (x)\n \"Did parsing fail?\"\n `(eq :fail ,x))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(defmethod nil\n (progn))\n\nIssue: Macro call that should be transformed by DEFMETHOD", "input": "(defmethod nil\n (progn))", "output": "(defmacro DEFMETHOD ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(define-generic* nil\n nil)\n\nProblem: Macro call that should be transformed by DEFINE-GENERIC*", "input": "(define-generic* nil\n nil)", "output": "(defmacro DEFINE-GENERIC* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(fm-other? 'lol-gen::some-name)\n\nProblem: Macro call that should be transformed by FM-OTHER?", "input": "(fm-other? 'lol-gen::some-name)", "output": "(defmacro fm-other? (md-name &optional (starting 'self) (global-search t))\n `(fm-find-one ,starting ,(if (consp md-name)\n `(list ',(car md-name) ,(cadr md-name))\n `',md-name)\n :must-find nil\n :global-search ,global-search))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(print-values\n nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by PRINT-VALUES", "input": "(print-values\n nil\n nil)", "output": "(defmacro PRINT-VALUES ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(->)\n\nIssue: Macro call that should be transformed by ->", "input": "(->)", "output": "(defmacro -> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with-packages-unlocked nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by WITH-PACKAGES-UNLOCKED", "input": "(with-packages-unlocked nil\n (progn))", "output": "(defmacro WITH-PACKAGES-UNLOCKED ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(secase 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by SECASE", "input": "(secase 'lol-gen::some-name)", "output": "(defmacro secase (keyform &body cases)\n \"Like ECASE, except binds the keyform to IT (via SYMBOL-MACROLET) for the\nscope of the cases. IT can be set with SETF.\"\n `(symbolic ecase ,keyform ,@cases))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(sunless nil\n nil)\n\nIssue: Macro call that should be transformed by SUNLESS", "input": "(sunless nil\n nil)", "output": "(defmacro sunless (test &body body)\n \"Like UNLESS, except binds the test form to IT (via SYMBOL-MACROLET) for the\nscope of the body. IT can be set with SETF.\"\n `(symbolic unless ,test ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(defpackage nil (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by DEFPACKAGE", "input": "(defpackage nil (progn))", "output": "(defmacro DEFPACKAGE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(old nil)\n\nWrite a macro that addresses: Macro call that should be transformed by OLD", "input": "(old nil)", "output": "(defmacro old (expression)\n \"Only available in postconditions, OLD evaluates its expression before the\n primary method is executed and stores it for use in the postcondition.\"\n (let ((value (gensym)))\n `(if *preparing-postconditions*\n (let ((,value ,expression))\n (push ,value *postcondition-values*)\n ,value)\n (pop *postcondition-values*))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "intermediate", "quality_score": 0.7975}
{"instruction": "Generate a defmacro form that transforms code like this:\n(current-decoder nil (progn))\n\nPattern to recognize: Macro call that should be transformed by CURRENT-DECODER", "input": "(current-decoder nil (progn))", "output": "(defmacro current-decoder (&rest keys)\n \"Capture current values of custom variables and return a custom\ndecoder which restores these values in its dynamic environment.\"\n (let (exterior-bindings customizations)\n (flet ((collect (key var)\n (let ((exterior (gensym)))\n (push (list exterior var) exterior-bindings)\n (push exterior customizations)\n (push key customizations))))\n (if keys\n (loop for key in keys\n do (collect key (custom-key-to-variable key)))\n (loop-on-custom (key var)\n do (collect key var)))\n `(let ,exterior-bindings\n (custom-decoder ,@customizations)))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "intermediate", "quality_score": 0.7975}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(multiple-value-prog2 nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by MULTIPLE-VALUE-PROG2", "input": "(multiple-value-prog2 nil\n nil)", "output": "(defmacro multiple-value-prog2 (first-form second-form &body forms)\n \"Evaluates FIRST-FORM, then SECOND-FORM, and then FORMS. Yields as its value\nall the value returned by SECOND-FORM.\"\n `(progn ,first-form (multiple-value-prog1 ,second-form ,@forms)))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(resolve\n nil)\n\nIssue: Macro call that should be transformed by RESOLVE", "input": "(resolve\n nil)", "output": "(defmacro RESOLVE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(defunion nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by DEFUNION", "input": "(defunion nil\n :key\n nil)", "output": "(defmacro defunion (union &body variants)\n \"Define an algebraic data type.\n\nEach expression in VARIANTS is either a symbol \\(in which case it\ndefines a unit type, as with `defunit') or a list \\(in which case it\ndefines a read-only structure, as with `defconstructor').\n\nUNION is defined as a type equivalent to the disjunction of all the\nmember types. A class is also defined, with the same name, but with\nangle brackets around it.\"\n (let* ((docstring (and (stringp (first variants))\n (pop variants)))\n (ctors (remove-if-not #'listp variants))\n (units (remove-if-not #'atom variants))\n (types (append units (mapcar #'first ctors)))\n (super (symbolicate '< union '>)))\n ;; CCL (and maybe other lisps) evaluates `(:include)' options at\n ;; macroexpansion time and does some environment augmenting and checking\n ;; that fails to account for our `env-super' trick.\n ;; So define the abstract base struct via a `progn' at the toplevel.\n `(progn\n (eval-when (:compile-toplevel :load-toplevel :execute)\n (defstruct (,super\n (:constructor nil)\n (:copier nil)\n (:predicate nil)\n (:include %read-only-struct))\n ,@(unsplice docstring)))\n ;; NB The declarations are not currently used, due to an SBCL bug.\n (locally (declare #+sbcl (sb-ext:disable-package-locks %union))\n (symbol-macrolet ((serapeum/unlocked:%union ,super))\n (declare #+sbcl (sb-ext:enable-package-locks %union))\n (deftype ,union ()\n ,@(unsplice docstring)\n '(or ,@types))\n ,@(loop for type in units\n collect `(defunit ,type))\n ,@(loop for (type . slots) in ctors\n collect `(defconstructor ,type ,@slots))\n (declaim-freeze-type ,super)\n ',union)))))", "category": "anaphoric", "technique": "symbol-macrolet,anaphor", "complexity": "advanced", "quality_score": 0.8925}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(export\n common-lisp:nil\n :key\n common-lisp:nil)\n\nWhat needs to change: Macro call that should be transformed by EXPORT", "input": "(export\n common-lisp:nil\n :key\n common-lisp:nil)", "output": "(defmacro EXPORT ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8049999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(eko 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by EKO", "input": "(eko 'lol-gen::some-name)", "output": "(defmacro eko ((&rest trcargs) &rest body)\n (let ((result (gensym)))\n `(let ((,result ,@body))\n ,(if (stringp (car trcargs))\n `(trc ,(car trcargs) :=> ,result ,@(cdr trcargs))\n `(trc ,(car trcargs) ,(cadr trcargs) :=> ,result ,@(cddr trcargs)))\n ,result)))", "category": "control-flow", "technique": "gensym", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(dynamic-let* nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by DYNAMIC-LET*", "input": "(dynamic-let* nil\n (progn))", "output": "(defmacro DYNAMIC-LET* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(enable-interpol-syntax nil (progn))\n\nPattern to recognize: Macro call that should be transformed by ENABLE-INTERPOL-SYNTAX", "input": "(enable-interpol-syntax nil (progn))", "output": "(defmacro enable-interpol-syntax (&rest %enable-interpol-syntax-args)\n \"Enable CL-INTERPOL reader syntax.\"\n `(eval-when (:compile-toplevel :load-toplevel :execute)\n (%enable-interpol-syntax ,@%enable-interpol-syntax-args)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(assert nil)\n\nWrite a macro that addresses: Macro call that should be transformed by ASSERT", "input": "(assert nil)", "output": "(defmacro ASSERT ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(some->> nil\n :key\n nil)\n\nIssue: Macro call that should be transformed by SOME->>", "input": "(some->> nil\n :key\n nil)", "output": "(defmacro some->> (init &body exps) (arrow-macro init exps t t))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(case-let 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by CASE-LET", "input": "(case-let 'lol-gen::some-name)", "output": "(defmacro case-let ((var expr) &body cases)\n \"Like (let ((VAR EXPR)) (case VAR ...)), with VAR read-only.\"\n `(let1 ,var ,expr\n (case ,var\n ,@cases)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(the nil)\n\nPattern to recognize: Macro call that should be transformed by THE", "input": "(the nil)", "output": "(defmacro THE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(c?n-until nil\n :key\n nil)\n\nPattern to recognize: Macro call that should be transformed by C?N-UNTIL", "input": "(c?n-until nil\n :key\n nil)", "output": "(defmacro c?n-until (args &body body)\n `(make-c-dependent\n :optimize :when-value-t\n :code ',body\n :inputp t\n :value-state :unevaluated\n :rule (c-lambda ,@body)\n ,@args))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(ccase nil ())\n\nWhat needs to change: Macro call that should be transformed by CCASE", "input": "(ccase nil ())", "output": "(defmacro CCASE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(with-foreign-strings nil)\n\nPattern to recognize: Macro call that should be transformed by WITH-FOREIGN-STRINGS", "input": "(with-foreign-strings nil)", "output": "(defmacro with-foreign-strings (bindings &body body)\n \"See WITH-FOREIGN-STRING's documentation.\"\n (if bindings\n `(with-foreign-string ,(first bindings)\n (with-foreign-strings ,(rest bindings)\n ,@body))\n `(progn ,@body)))", "category": "dsl", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.815}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(defmacro common-lisp:nil\n (common-lisp:progn))\n\nWrite a macro that addresses: Macro call that should be transformed by DEFMACRO", "input": "(defmacro common-lisp:nil\n (common-lisp:progn))", "output": "(defmacro DEFMACRO ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(make-method 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by MAKE-METHOD", "input": "(make-method 'lol-gen::some-name)", "output": "(defmacro make-method (form)\n `(cl:make-method ,form))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(form-attribute nil (progn))\n\nPattern to recognize: Macro call that should be transformed by FORM-ATTRIBUTE", "input": "(form-attribute nil (progn))", "output": "(defmacro FORM-ATTRIBUTE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(iter\n 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by ITER", "input": "(iter\n 'lol-gen::some-name)", "output": "(defmacro ITER ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(global\n nil)\n\nProblem: Macro call that should be transformed by GLOBAL", "input": "(global\n nil)", "output": "(defmacro GLOBAL ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with-active-layers nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by WITH-ACTIVE-LAYERS", "input": "(with-active-layers nil\n (progn))", "output": "(defmacro WITH-ACTIVE-LAYERS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(ensure 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by ENSURE", "input": "(ensure 'lol-gen::some-name)", "output": "(defmacro ensure (place &body newval\n &environment env)\n \"Essentially (or place (setf place newval)).\n\nPLACE is treated as unbound if it returns `nil', signals\n`unbound-slot', or signals `unbound-variable'.\n\nNote that ENSURE is `setf'-able, so you can do things like\n (incf (ensure x 0))\n\nCf. `ensure2'.\"\n (multiple-value-bind (vars vals stores setter getter)\n (get-setf-expansion place env)\n `(let* ,(mapcar #'list vars vals)\n (or (ignore-some-conditions (unbound-slot unbound-variable)\n ,getter)\n (multiple-value-bind ,stores\n (progn ,@newval)\n (when ,(first stores)\n ,setter))))))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Generate a defmacro form that transforms code like this:\n(bgo nil)\n\nPattern to recognize: Macro call that should be transformed by BGO", "input": "(bgo nil)", "output": "(defmacro bgo (msg)\n `(break \"BGO ~a\" ',msg))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(defguarantee nil\n (progn))\n\nProblem: Macro call that should be transformed by DEFGUARANTEE", "input": "(defguarantee nil\n (progn))", "output": "(defmacro defguarantee (name (&rest lambda-list) &body body)\n \"Adds a postcondition to the NAMEd function. It can be either a generic or\n non-generic function. If it's the former, then use a specialized lambda list,\n otherwise use an ordinary lambda list. The docstring, if any, will be used in\n failure reports.\"\n #+qpq-postcondition-checks-disabled\n (declare (ignore name lambda-list body))\n #+qpq-postcondition-checks-disabled\n (values)\n #-qpq-postcondition-checks-disabled\n (multiple-value-bind (remaining-forms declarations doc-string)\n (parse-body body :documentation t)\n (declare (ignore declarations))\n (let* ((stripped-ll (strip-lambda-list lambda-list))\n (lambda-vars (remove-if (rcurry #'member\n '(&optional &rest\n &key &allow-other-keys &aux))\n stripped-ll))\n (method `(progn\n (ensure-contracted-function ',name ',stripped-ll)\n (defmethod ,name\n :guarantee\n ,(or doc-string\n (format nil \"~A\"\n (description<-remaining-forms\n remaining-forms)))\n ,lambda-list\n (declare (ignorable ,@lambda-vars))\n ,@body))))\n (if (every #'symbolp lambda-list)\n `(if (and (fboundp ',name)\n (not (typep (fdefinition ',name) 'generic-function)))\n (defcontract ,name :guarantee ,lambda-list\n (declare (ignorable ,@lambda-vars))\n ,@body)\n ,method)\n method))))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(string-ecase nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by STRING-ECASE", "input": "(string-ecase nil\n (progn))", "output": "(defmacro STRING-ECASE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(named-lambda nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by NAMED-LAMBDA", "input": "(named-lambda nil\n nil)", "output": "(defmacro named-lambda (name lambda-list &body body)\n \"Expands into a lambda-expression within whose BODY NAME denotes the\ncorresponding function.\"\n `(labels ((,name ,lambda-list ,@body))\n #',name))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(custom-decoder nil (progn))\n\nIssue: Macro call that should be transformed by CUSTOM-DECODER", "input": "(custom-decoder nil (progn))", "output": "(defmacro custom-decoder (&rest customizations)\n \"Return a function which is like DECODE-JSON called in a dynamic\nenvironment with the given CUSTOMIZATIONS.\"\n `(lambda (&optional (stream *json-input*))\n (bind-custom-vars ,customizations\n (decode-json stream))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(defun-ematch* common-lisp:nil\n (common-lisp:progn))\n\nPattern to recognize: Macro call that should be transformed by DEFUN-EMATCH*", "input": "(defun-ematch* common-lisp:nil\n (common-lisp:progn))", "output": "(defmacro defun-ematch* (name args &body body)\n \"Equivalent to (defun (arg) [decl-and-docstring] (ematch arg (PATTERN BODY...))).\"\n (multiple-value-bind (preamble clauses) (parse-matcher-body body)\n `(defun ,name ,args\n ,@preamble\n (ematch* ,args\n ,@clauses))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8999999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(ematch nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by EMATCH", "input": "(ematch nil\n (progn))", "output": "(defmacro ematch (arg &body clauses)\n \"Same as MATCH, except MATCH-ERROR will be raised if not matched.\"\n (once-only (arg)\n (let ((else `(error 'match-error\n :values (list ,arg)\n :patterns ',(mapcar (lambda (c) (list (car c))) clauses))))\n (compile-match-1 arg clauses else))))", "category": "control-flow", "technique": "once-only", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(without-recursion nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by WITHOUT-RECURSION", "input": "(without-recursion nil\n nil)", "output": "(defmacro without-recursion ((&key) &body body)\n \"If BODY calls itself, at any depth, signal a (continuable) error of\ntype `recursion-forbidden'.\"\n (with-unique-names (recursion-id)\n `(progn\n (when (member ',recursion-id *recursions*)\n (cerror \"Recurse anyway.\"\n 'recursion-forbidden\n :form ',body))\n (let ((*recursions* (cons ',recursion-id *recursions*)))\n (declare (dynamic-extent *recursions*))\n ,@body))))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(dynamic-relet* nil\n (progn))\n\nWhat needs to change: Macro call that should be transformed by DYNAMIC-RELET*", "input": "(dynamic-relet* nil\n (progn))", "output": "(defmacro DYNAMIC-RELET* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(collect-file nil :key nil)\n\nPattern to recognize: Macro call that should be transformed by COLLECT-FILE", "input": "(collect-file nil :key nil)", "output": "(defmacro COLLECT-FILE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(newq nil :key nil)\n\nWrite a macro that addresses: Macro call that should be transformed by NEWQ", "input": "(newq nil :key nil)", "output": "(defmacro NEWQ ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(block-compile nil)\n\nWrite a macro that addresses: Macro call that should be transformed by BLOCK-COMPILE", "input": "(block-compile nil)", "output": "(defmacro block-compile ((&key entry-points\n (block-compile t))\n &body body)\n \"Shorthand for block compilation with `local*'.\n\nOnly the functions in ENTRY-POINTS will have global definitions. All\nother functions in BODY will be compiled as purely local functions,\nand all of their calls to one another will be compiled as local calls.\nThis includes calls to the entry points, and even self-calls from\nwithin the entry points.\n\nNote that `declaim' forms occuring inside of BODY will be translated\ninto local `declare' forms.\n\nIf you pass `:block-compile nil', this macro is equivalent to progn.\nThis may be useful during development.\"\n (if (not block-compile) `(progn ,@body)\n `(local*\n ,@body\n (progn\n ,@(loop for entry-point in entry-points\n collect `(defalias ,entry-point #',entry-point))))))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with-constant-inject-hook nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by WITH-CONSTANT-INJECT-HOOK", "input": "(with-constant-inject-hook nil\n (progn))", "output": "(defmacro with-constant-inject-hook (func &body body)\n (let ((func-name (gensym \"hook\")))\n `(let* ((,func-name ,func)\n (*constant-inject-hook* ,func-name))\n ,@body)))", "category": "dsl", "technique": "gensym", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(defun-ematch* common-lisp:nil\n common-lisp:nil)\n\nWrite a macro that addresses: Macro call that should be transformed by DEFUN-EMATCH*", "input": "(defun-ematch* common-lisp:nil\n common-lisp:nil)", "output": "(defmacro defun-ematch* (name args &body body)\n \"Equivalent to (defun (arg) [decl-and-docstring] (ematch arg (PATTERN BODY...))).\"\n (multiple-value-bind (preamble clauses) (parse-matcher-body body)\n `(defun ,name ,args\n ,@preamble\n (ematch* ,args\n ,@clauses))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8999999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(ignore-errors)\n\nWrite a macro that addresses: Macro call that should be transformed by IGNORE-ERRORS", "input": "(ignore-errors)", "output": "(defmacro IGNORE-ERRORS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(check-type nil nil)\n\nWrite a macro that addresses: Macro call that should be transformed by CHECK-TYPE", "input": "(check-type nil nil)", "output": "(defmacro CHECK-TYPE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(bind nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by BIND", "input": "(bind nil\n (progn))", "output": "(defmacro bind ((&rest bindings) &body body)\n \"Bind variables from BINDINGS to be active inside BODY, as if by LET*,\ncombined with MULTIPLE-VALUE-BIND, DESTRUCTURING-BIND and other -bind forms,\ndepending on the type of the first argument.\"\n (let ((rez body))\n (dolist (binding (reverse bindings))\n (setf rez `((,@(funcall #'expand-binding binding rez)))))\n (first rez)))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.815}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(as->* nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by AS->*", "input": "(as->* nil\n (progn))", "output": "(defmacro AS->* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(enable-punch-syntax)\n\nWhat needs to change: Macro call that should be transformed by ENABLE-PUNCH-SYNTAX", "input": "(enable-punch-syntax)", "output": "(defmacro enable-punch-syntax ()\n '(eval-when (:compile-toplevel :load-toplevel :execute)\n (cl-syntax:use-syntax punch-syntax)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(define-definition-resolver nil\n (progn))\n\nWhat needs to change: Macro call that should be transformed by DEFINE-DEFINITION-RESOLVER", "input": "(define-definition-resolver nil\n (progn))", "output": "(defmacro define-definition-resolver (name args &body body)\n `(progn (setf (definition-resolver ',name)\n (lambda ,args ,@body))\n ',name))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(splice-seqf nil nil)\n\nWhat needs to change: Macro call that should be transformed by SPLICE-SEQF", "input": "(splice-seqf nil nil)", "output": "(defmacro SPLICE-SEQF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(reduced-typecase 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by REDUCED-TYPECASE", "input": "(reduced-typecase 'lol-gen::some-name)", "output": "(defmacro REDUCED-TYPECASE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(define-declaration nil\n (progn))\n\nPattern to recognize: Macro call that should be transformed by DEFINE-DECLARATION", "input": "(define-declaration nil\n (progn))", "output": "(defmacro DEFINE-DECLARATION ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(handler-bind nil\n nil)\n\nIssue: Macro call that should be transformed by HANDLER-BIND", "input": "(handler-bind nil\n nil)", "output": "(defmacro HANDLER-BIND ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(def-bop nil)\n\nPattern to recognize: Macro call that should be transformed by DEF-BOP", "input": "(def-bop nil)", "output": "(defmacro DEF-BOP ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "Generate a defmacro form that transforms code like this:\n(c?1\n nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by C?1", "input": "(c?1\n nil\n nil)", "output": "(defmacro c?1 (&body body)\n `(c?once ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(defoptimizer common-lisp:nil\n common-lisp:nil)\n\nPattern to recognize: Macro call that should be transformed by DEFOPTIMIZER", "input": "(defoptimizer common-lisp:nil\n common-lisp:nil)", "output": "(defmacro defoptimizer (name args &body body)\n `(eval-when (:compile-toplevel :load-toplevel :execute)\n (setf (symbol-optimizer ',name)\n #+sbcl\n (sb-int:named-lambda ',name ,args ,@body)\n #-sbcl\n (lambda ,args ,@body))\n ,@(when (stringp (first body))\n ;; lisp-namespace\n `((setf (documentation ',name 'optimizer)\n ,(let ((*print-pretty* t))\n #-clisp\n (format nil \"~<Lambda-List: ~s~\n ~:@_~< ~@;~a~:>~\n ~:>\"\n (list args (list (first body))))\n #+clisp\n (format nil \"Lambda-List: ~s~%~a\"\n args (first body))))))))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Generate a defmacro form that transforms code like this:\n(*let nil\n :key\n nil)\n\nPattern to recognize: Macro call that should be transformed by *LET", "input": "(*let nil\n :key\n nil)", "output": "(defmacro *LET ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(pprint-coalton-codegen\n common-lisp:nil\n :key\n common-lisp:nil)\n\nIssue: Macro call that should be transformed by PPRINT-COALTON-CODEGEN", "input": "(pprint-coalton-codegen\n common-lisp:nil\n :key\n common-lisp:nil)", "output": "(defmacro PPRINT-COALTON-CODEGEN ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8049999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(for-all nil\n (progn))\n\nPattern to recognize: Macro call that should be transformed by FOR-ALL", "input": "(for-all nil\n (progn))", "output": "(defmacro for-all (bindings &body body)\n \"Bind BINDINGS to random variables and test BODY *num-trials* times.\n\nBINDINGS is a list of binding forms, each element is a list\nof (BINDING VALUE &optional GUARD). Value, which is evaluated\nonce when the for-all is evaluated, must return a generator which\nbe called each time BODY is evaluated. BINDING is either a symbol\nor a list which will be passed to destructuring-bind. GUARD is a\nform which, if present, stops BODY from executing when IT returns\nNIL. The GUARDS are evaluated after all the random data has been\ngenerated and they can refer to the current value of any\nbinding. NB: Generator forms, unlike guard forms, can not contain\nreferences to the bound variables.\n\nExamples:\n\n (for-all ((a (gen-integer)))\n (is (integerp a)))\n\n (for-all ((a (gen-integer) (plusp a)))\n (is (integerp a))\n (is (plusp a)))\n\n (for-all ((less (gen-integer))\n (more (gen-integer) (< less more)))\n (is (<= less more)))\n\n (for-all (((a b) (gen-two-integers)))\n (is (integerp a))\n (is (integerp b)))\"\n (with-gensyms (test-lambda-args)\n `(perform-random-testing\n (list ,@(mapcar #'second bindings))\n (lambda (,test-lambda-args)\n (destructuring-bind ,(mapcar #'first bindings)\n ,test-lambda-args\n (if (and ,@(delete-if #'null (mapcar #'third bindings)))\n (progn ,@body)\n (throw 'run-once\n (list :guard-conditions-failed))))))))", "category": "capture-management", "technique": "gensym,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(order-by 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by ORDER-BY", "input": "(order-by 'lol-gen::some-name)", "output": "(defmacro ORDER-BY ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(finally 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by FINALLY", "input": "(finally 'lol-gen::some-name)", "output": "(defmacro FINALLY ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(auto-permute-typecase nil)\n\nWrite a macro that addresses: Macro call that should be transformed by AUTO-PERMUTE-TYPECASE", "input": "(auto-permute-typecase nil)", "output": "(defmacro AUTO-PERMUTE-TYPECASE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(ignore-errors nil :key nil)\n\nIssue: Macro call that should be transformed by IGNORE-ERRORS", "input": "(ignore-errors nil :key nil)", "output": "(defmacro IGNORE-ERRORS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(def-suite* nil)\n\nWrite a macro that addresses: Macro call that should be transformed by DEF-SUITE*", "input": "(def-suite* nil)", "output": "(defmacro def-suite* (name &rest def-suite-args)\n `(progn\n (def-suite ,name ,@def-suite-args)\n (in-suite ,name)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(enable-quasi-quoted-bivalent-to-bivalent-emitting-form-syntax nil)\n\nWhat needs to change: Macro call that should be transformed by ENABLE-QUASI-QUOTED-BIVALENT-TO-BIVALENT-EMITTING-FORM-SYNTAX", "input": "(enable-quasi-quoted-bivalent-to-bivalent-emitting-form-syntax nil)", "output": "(defmacro ENABLE-QUASI-QUOTED-BIVALENT-TO-BIVALENT-EMITTING-FORM-SYNTAX ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8049999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(enable-quasi-quoted-binary-syntax)\n\nWhat needs to change: Macro call that should be transformed by ENABLE-QUASI-QUOTED-BINARY-SYNTAX", "input": "(enable-quasi-quoted-binary-syntax)", "output": "(defmacro ENABLE-QUASI-QUOTED-BINARY-SYNTAX ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(alt nil)\n\nPattern to recognize: Macro call that should be transformed by ALT", "input": "(alt nil)", "output": "(defmacro alt (parser &rest parsers)\n \"Accept the results of the first parser from a group to succeed.\"\n (let ((offset (gensym \"ALT-OFFSET\")))\n `(lambda (,offset)\n ,(labels ((recurse (ps furthest)\n (if (null ps)\n `(fail ,furthest)\n (let ((res (gensym \"ALT-RES\"))\n (next (gensym \"ALT-NEXT\")))\n `(multiple-value-bind (,res ,next) (funcall ,(car ps) ,offset)\n (if (ok? ,res)\n (values ,res ,next)\n ,(recurse (cdr ps) `(max ,next ,furthest))))))))\n (recurse (cons parser parsers) offset)))))", "category": "control-flow", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(skip nil)\n\nWrite a macro that addresses: Macro call that should be transformed by SKIP", "input": "(skip nil)", "output": "(defmacro skip (&rest reason)\n \"Generates a TEST-SKIPPED result.\"\n `(add-result 'test-skipped :reason (format nil ,@reason)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Generate a defmacro form that transforms code like this:\n(raw nil :key nil)\n\nPattern to recognize: Macro call that should be transformed by RAW", "input": "(raw nil :key nil)", "output": "(defmacro raw (&rest forms)\n `(list ,@forms))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(all-of nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by ALL-OF", "input": "(all-of nil\n nil)", "output": "(defmacro ALL-OF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(stypecase nil\n nil)\n\nProblem: Macro call that should be transformed by STYPECASE", "input": "(stypecase nil\n nil)", "output": "(defmacro stypecase (keyform &body cases)\n \"Like TYPECASE, except binds the keyform to IT (via SYMBOL-MACROLET) for the\nscope of the cases. IT can be set with SETF.\"\n `(symbolic typecase ,keyform ,@cases))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(and-let nil (progn))\n\nIssue: Macro call that should be transformed by AND-LET", "input": "(and-let nil (progn))", "output": "(defmacro and-let (var &rest args)\n \"Like AND. VAR will be bound to the value of the previous AND form\"\n (cond ((null args) t)\n ((null (cdr args)) (car args))\n (t `(when-let (,var ,(car args))\n (and ,@(cdr args))))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7775}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(match* common-lisp:nil\n :key\n common-lisp:nil)\n\nWrite a macro that addresses: Macro call that should be transformed by MATCH*", "input": "(match* common-lisp:nil\n :key\n common-lisp:nil)", "output": "(defmacro match* (whats &body clauses)\n #.+match*-doc+ \n `(match2* ,whats\n ,@clauses\n (_ nil)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(dynamic-relet* nil)\n\nWhat needs to change: Macro call that should be transformed by DYNAMIC-RELET*", "input": "(dynamic-relet* nil)", "output": "(defmacro DYNAMIC-RELET* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(nconcf nil :key nil)\n\nIssue: Macro call that should be transformed by NCONCF", "input": "(nconcf nil :key nil)", "output": "(defmacro NCONCF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(newq nil (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by NEWQ", "input": "(newq nil (progn))", "output": "(defmacro NEWQ ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(with-logical-transaction nil\n :key\n nil)\n\nProblem: Macro call that should be transformed by WITH-LOGICAL-TRANSACTION", "input": "(with-logical-transaction nil\n :key\n nil)", "output": "(defmacro with-logical-transaction ((&optional (name nil name-p)\n (isolation-level *isolation-level*\n isolation-level-p))\n &body body)\n \"Executes body within a with-transaction form if no transaction is currently\nin progress, otherwise simulates a nested transaction by executing it\nwithin a with-savepoint form. The transaction or savepoint is bound to name\nif one is supplied. The isolation-level will set the isolation-level used by\nthe transaction.\n\nYou can specify the following isolation levels in postmodern transactions:\n\n- :read-committed-rw (read committed with read and write)\n- :read-committed-ro (read committed with read only)\n- :repeatable-read-rw (repeatable read with read and write)\n- :repeatable-read-ro (repeatable read with read only)\n- :serializable (serializable with reand and write)\n\nSample usage where george is just the name given to the transaction (not\nquoted or a string) and ... simply indicates other statements would be\nexpected here:\n\n\n (with-logical-transaction ()\n (execute (:insert-into 'test-data :set 'value 77))\n ...)\n\n (with-logical-transaction (george)\n (execute (:insert-into 'test-data :set 'value 22))\n ...)\n\n (with-logical-transaction (george :read-committed-rw)\n (execute (:insert-into 'test-data :set 'value 33))\n ...)\n\n (with-logical-transaction (:serializable)\n (execute (:insert-into 'test-data :set 'value 44))\n ...)\"\n (let* ((effective-name (if (and name-p (not (isolation-level-p name)))\n name\n (gensym)))\n (effective-body (if (and name-p (not (isolation-level-p name)))\n `(lambda (,name) ,@body)\n `(lambda (,effective-name)\n (declare (ignore ,effective-name))\n ,@body)))\n (effective-isolation-level (cond ((and isolation-level-p\n (isolation-level-p isolation-level))\n isolation-level)\n ((and name-p (isolation-level-p name))\n name)\n (t isolation-level))))\n `(call-with-logical-transaction ',effective-name ,effective-body\n ,effective-isolation-level)))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.85}
{"instruction": "Generate a defmacro form that transforms code like this:\n(peek 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by PEEK", "input": "(peek 'lol-gen::some-name)", "output": "(defmacro peek (form)\n \"Read the value of cells without triggering a recomputation.\n\nFORM is evaluated in a context such that when the value of a cell is\nreferenced it is not registered as an argument cell of the cell in\nwhich the PEEK form is evaluated. This means that the value of the\ncell, in which the PEEK form is evaluated, will not be recomputed when\nthe values of the cells referenced in FORM change.\n\nIn the following example\n\n.. code-block::\n\n (defcell a 0)\n (defcell b 1)\n\n (defcell sum (+ a (peek b))\n\nthe SUM cell references the value of A directly and *peeks* the value\nof B (using PEEK). Changing the value of A will cause the value of the\nSUM cell to be recomputed. However, changing the value of B will not\ncause the value of SUM to be computed.\n\n.. important::\n\n This macro has no effect if CELL is referenced outside a PEEK form\n within the same cell definition.\n\n .. code-block::\n\n (defcell sum (+ b (peek b))\n\n In this example, PEEK has no effect because the SUM cell references\n B outside a PEEK form.\n\n\"\n\n (with-gensyms (arg-cell\n did-change\n observer-arg\n tracker\n update\n will-update)\n\n (let* ((key ``(peek ,(argument-key ,arg-cell)))\n (observer-record\n `(make-observer\n :key ,key\n :will-update #',will-update\n :update #',update)))\n\n `(flet ((,update (,arg-cell ,did-change)\n (declare (ignore ,arg-cell ,did-change)))\n (,will-update (,arg-cell)\n (declare (ignore ,arg-cell))))\n\n (let ((,tracker *track-cell-callback*))\n (with-tracker\n ((,arg-cell)\n (let ((*track-cell-callback* ,tracker))\n (track-argument\n (make-argument\n :key ,key\n :add-observer (lambda (,observer-arg)\n (declare (ignore ,observer-arg))\n (call-add-observer ,arg-cell ,observer-record))\n :remove-observer (lambda (,observer-arg)\n (declare (ignore ,observer-arg))\n (call-remove-observer ,arg-cell ,observer-record))))))\n\n ,form))))))", "category": "anaphoric", "technique": "gensym,nested-backquote,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(unionf nil :key nil)\n\nPattern to recognize: Macro call that should be transformed by UNIONF", "input": "(unionf nil :key nil)", "output": "(defmacro UNIONF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(finishes\n nil\n nil)\n\nWhat needs to change: Macro call that should be transformed by FINISHES", "input": "(finishes\n nil\n nil)", "output": "(defmacro finishes (&body body)\n \"Generates a pass if BODY executes to normal completion. In\nother words if body does signal, return-from or throw this test\nfails.\"\n `(unwind-protect-case () (progn ,@body)\n (:normal (add-result 'test-passed :test-expr ',body))\n (:abort (process-failure ',body \"Test didn't finish\"))))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(when nil)\n\nIssue: Macro call that should be transformed by WHEN", "input": "(when nil)", "output": "(defmacro WHEN ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(nunionf nil nil)\n\nPattern to recognize: Macro call that should be transformed by NUNIONF", "input": "(nunionf nil nil)", "output": "(defmacro NUNIONF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(aand)\n\nWrite a macro that addresses: Macro call that should be transformed by AAND", "input": "(aand)", "output": "(defmacro AAND ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-live-scope\n nil\n (progn))\n\nIssue: Macro call that should be transformed by WITH-LIVE-SCOPE", "input": "(with-live-scope\n nil\n (progn))", "output": "(defmacro with-live-scope (&body body)\n \"Stop all live blocks defined in BODY on exiting the form.\n\nAll live blocks, defined using LIVE, are stopped when exiting the\ndynamic extent defined by this form.\n\nMultiple WITH-LIVE-SCOPE forms can be nested, in which case each form\nstops the live blocks defined immediately within it.\"\n\n (with-gensyms (stoppers forms global-live)\n `(let ((,stoppers nil))\n (macrolet ((,global-live (&body ,forms)\n (macroexpand `(live ,@,forms)))\n\n (live (&body ,forms)\n `(push (,',global-live ,@,forms) ,',stoppers)))\n (unwind-protect (progn ,@body)\n (foreach #'funcall ,stoppers))))))", "category": "anaphoric", "technique": "macrolet,gensym,anaphor", "complexity": "intermediate", "quality_score": 0.825}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(for nil (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by FOR", "input": "(for nil (progn))", "output": "(defmacro FOR ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "Generate a defmacro form that transforms code like this:\n(define-module nil\n (progn))\n\nPattern to recognize: Macro call that should be transformed by DEFINE-MODULE", "input": "(define-module nil\n (progn))", "output": "(defmacro define-module (name &body options)\n (let ((name (string name))\n (package (gensym \"PACKAGE\")))\n `(eval-when (:compile-toplevel :load-toplevel :execute)\n (let ((,package (or (find-package ,name)\n (make-package ,name :use ()))))\n (modularize :package ,package :name ,name)\n (expand-module ,name ',options)\n ,package))))", "category": "dsl", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(cell-let nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by CELL-LET", "input": "(cell-let nil\n (progn))", "output": "(defmacro cell-let ((&rest bindings) &body body &environment env)\n \"Define cells that are visible only to the forms in BODY.\n\nBINDINGS is a list of cell bindings to establish, similar to\nLET*. Each item in BINDINGS is a list of the form\n\n.. code-block::\n\n (NAME VALUE-FORM)\n\nwhere NAME is the symbol identifying the cell and VALUE-FORM is the\nvalue form of the cell. The cell can then be referenced within the\nforms in BODY by the symbol NAME.\n\nThe cells defined in BINDINGS lexcially shadow those in the\nenvironment defined with DEFCELL or by an enclosing CELL-LET\nform. Like LET* and unlike LET, each cell definition may reference the\ncells defined earlier in the same CELL-LET.\n\nThe forms in BODY are evaluated in an implicit PROGN. The value\nreturned by the last form is returned by the CELL-LET form.\"\n\n (flet ((make-cell-binding (binding form)\n (destructuring-bind (name &optional initform)\n (ensure-list binding)\n\n (if (constantp initform env)\n `(mutable-cell-let% (,name ,initform) ,form)\n `(computed-cell-let% (,name ,initform) ,form)))))\n\n (->> `(progn ,@body)\n (reduce #'make-cell-binding bindings :from-end t :initial-value))))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(del-proxy nil)\n\nProblem: Macro call that should be transformed by DEL-PROXY", "input": "(del-proxy nil)", "output": "(defmacro del-proxy (slot &key (node-name 'item))\n \"Remove proxy-node in slot\"\n (let ((val (gensym)) (node-list (gensym)))\n `(let ((,val (slot-value ,node-name ',slot)))\n (if (eql (find-class 'nodelist) (class-of (slot-value ,node-name ',slot)))\n \t (let ((,node-list (slot-value (slot-value ,node-name ',slot) 'nodes)))\n \t (setf (slot-value (slot-value ,node-name ',slot) 'nodes)\n \t\t (loop for i in ,node-list collect\n \t\t\t(slot-value i 'proxy-subnode))))\n \t (if ,val (setf (slot-value ,node-name ',slot)\n \t\t\t (slot-value ,val 'proxy-subnode)))))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "intermediate", "quality_score": 0.7975}
{"instruction": "Generate a defmacro form that transforms code like this:\n(with-boolean nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by WITH-BOOLEAN", "input": "(with-boolean nil\n nil)", "output": "(defmacro with-boolean ((&rest branches) &body body\n &environment env)\n \"Establishes a lexical environment in which it is possible to use\nmacroexpand-time branching. Within the lexical scope of\n`with-boolean', it is possible to use `boolean-if', `boolean-when',\nand `boolean-unless' to conditionalize whether some forms are included\nat compilation time. (You may also use `:if', `:when', or `:unless'\nfor brevity.)\n\\\nThe first argument must be a list of symbols which name variables. This macro\nwill expand into a series of conditionals\"\n (cond (*boolean-bypass*\n `(progn ,@body))\n (t (let ((all-branches (macroexpand-1 '%all-branches% env)))\n `(macrolet ((:if (cond then else)\n (list 'boolean-if cond then else))\n (:when (cond &body then)\n (list* 'boolean-when cond then))\n (:unless (cond &body then)\n (list* 'boolean-unless cond then)))\n (locally\n (declare #+sbcl (sb-ext:disable-package-locks\n %in-branching% %all-branches%)\n #+sbcl (sb-ext:muffle-conditions\n sb-ext:code-deletion-note))\n (symbol-macrolet ((%in-branching% t)\n (%all-branches% (,@branches ,@all-branches))\n (%true-branches% ()))\n (locally (declare #+sbcl (sb-ext:enable-package-locks\n %in-branching% %all-branches%))\n (%with-boolean ,branches ,@body)))))))))", "category": "anaphoric", "technique": "symbol-macrolet,macrolet,anaphor", "complexity": "intermediate", "quality_score": 0.8925}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(ok? 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by OK?", "input": "(ok? 'lol-gen::some-name)", "output": "(defmacro ok? (x)\n \"Did parsing succeed?\"\n `(cl:not (failure? ,x)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(defpackage 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by DEFPACKAGE", "input": "(defpackage 'lol-gen::some-name)", "output": "(defmacro DEFPACKAGE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(or nil :key nil)\n\nPattern to recognize: Macro call that should be transformed by OR", "input": "(or nil :key nil)", "output": "(defmacro OR ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(defcell nil (progn))\n\nWhat needs to change: Macro call that should be transformed by DEFCELL", "input": "(defcell nil (progn))", "output": "(defmacro defcell (name value-form &environment env)\n \"Define a global cell identified by NAME.\n\nThis macro defines a cell identified by NAME with its value computed\nby VALUE-FORM. The value of the cell can be referenced by the symbol\nNAME following the DEFCELL form.\n\nIf VALUE-FORM is a constant, by CONSTANTP, a mutable cell is defined\nwhich can have its value set directly using SETF or SETQ on the symbol\nNAME.\n\nIf VALUE-FORM is not a constant a computed cell is created. A computed\ncell may reference one or more argument cells in VALUE-FORM or a\nfunction called during the evaluation of VALUE-FORM. When the values\nof any of the argument cells change, the value of the computed cell is\nrecomputed by evaluating VALUE-FORM again. The referenced argument\ncells are determined automatically when the VALUE-FORM is evaluated.\n\nThis macro creates a cell definition that is visible globally to all\nforms unless it is lexically shadowed by a definition with the same\nNAME using CELL-LET. Note that despite being visible globally, the\ncell definition is still lexically scoped and not dynamically scoped\nlike global variables defined with DEFVAR or DEFPARAMETER.\"\n\n (if (constantp value-form env)\n `(define-mutable-cell% ,name ,value-form)\n `(define-computed-cell% ,name ,value-form)))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(def-kid-slots 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by DEF-KID-SLOTS", "input": "(def-kid-slots 'lol-gen::some-name)", "output": "(defmacro def-kid-slots (&rest slot-defs)\n `(lambda (self)\n (declare (ignorable self))\n (list ,@slot-defs)))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(esc 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by ESC", "input": "(esc 'lol-gen::some-name)", "output": "(defmacro esc (&rest forms)\n `(list\n ,@(loop for form in forms\n collect (%escape-string-form form))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(eval-always)\n\nWrite a macro that addresses: Macro call that should be transformed by EVAL-ALWAYS", "input": "(eval-always)", "output": "(defmacro eval-always (&body body)\n \"Wrap BODY in eval-when with all keys (compile, load and execute) mentioned.\"\n `(eval-when (:compile-toplevel :load-toplevel :execute)\n ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(-<> nil)\n\nIssue: Macro call that should be transformed by -<>", "input": "(-<> nil)", "output": "(defmacro -<> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "Generate a defmacro form that transforms code like this:\n(char-ecase 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by CHAR-ECASE", "input": "(char-ecase 'lol-gen::some-name)", "output": "(defmacro char-ecase (keyform &body clauses)\n \"Like `ecase', but specifically for characters.\nExpands into `tree-case'.\"\n `(char-ecase-1 ,keyform\n ,@(expand-char-case-keys clauses)))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.8999999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(dispatch-caseql nil)\n\nPattern to recognize: Macro call that should be transformed by DISPATCH-CASEQL", "input": "(dispatch-caseql nil)", "output": "(defmacro dispatch-caseql ((&rest exprs-and-types) &body clauses)\n \"Like `dispatch-case', but types in clauses are implicitly wrapped in `eql'.\nThe syntax of `dispatch-caseql' is tohus closer to `case' than to\n`typecase'.\"\n (expect-form-list\n `(dispatch-case ,exprs-and-types\n ,@(expand-dispatch-caseql-clauses clauses))))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with-unique-names nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by WITH-UNIQUE-NAMES", "input": "(with-unique-names nil\n nil)", "output": "(defmacro with-unique-names (names &body forms)\n \"Alias for WITH-GENSYMS.\"\n `(with-gensyms ,names ,@forms))", "category": "capture-management", "technique": "gensym", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(with-active-layers* nil)\n\nWhat needs to change: Macro call that should be transformed by WITH-ACTIVE-LAYERS*", "input": "(with-active-layers* nil)", "output": "(defmacro WITH-ACTIVE-LAYERS* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(class/std nil\n :key\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by CLASS/STD", "input": "(class/std nil\n :key\n nil)", "output": "(defmacro class/std (name &body defaulted-slots)\n \"The most concise shortcut macro to DEFCLASS.\n\n (class/std example slot1 slot2 slot3)\n\n expands to:\n\n (DEFCLASS/STD EXAMPLE ()\n ((SLOT1 SLOT2 SLOT3)))\n\n which expands to:\n\n (DEFCLASS EXAMPLE ()\n ((SLOT1 :ACCESSOR SLOT1 :INITARG :SLOT1 :INITFORM NIL)\n (SLOT2 :ACCESSOR SLOT2 :INITARG :SLOT2 :INITFORM NIL)\n (SLOT3 :ACCESSOR SLOT3 :INITARG :SLOT3 :INITFORM NIL)))\n\"\n `(defclass/std ,name ()\n ((,@defaulted-slots))))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Generate a defmacro form that transforms code like this:\n(compiler-macro-lambda nil)\n\nPattern to recognize: Macro call that should be transformed by COMPILER-MACRO-LAMBDA", "input": "(compiler-macro-lambda nil)", "output": "(defmacro compiler-macro-lambda (lambda-list &body body)\n (introspect-environment:parse-compiler-macro (gensym \"COMPILER-MACRO-LAMBDA\")\n lambda-list\n body))", "category": "control-flow", "technique": "gensym", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(*> nil nil)\n\nPattern to recognize: Macro call that should be transformed by *>", "input": "(*> nil nil)", "output": "(defmacro *> (parser &rest parsers)\n \"Combination of parsers yielding the result of the rightmost one.\"\n (let ((offset (gensym \"*>-OFFSET\")))\n `(lambda (,offset)\n ,(reduce (lambda (i p)\n (let ((res (gensym \"*>-RES\"))\n (next (gensym \"*>-NEXT\")))\n `(multiple-value-bind (,res ,next) ,i\n (if (ok? ,res)\n (funcall ,p ,next)\n (fail ,next)))))\n parsers\n :initial-value `(funcall ,parser ,offset)))))", "category": "control-flow", "technique": "gensym", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(enable-quasi-quoted-bivalent-syntax)\n\nWrite a macro that addresses: Macro call that should be transformed by ENABLE-QUASI-QUOTED-BIVALENT-SYNTAX", "input": "(enable-quasi-quoted-bivalent-syntax)", "output": "(defmacro ENABLE-QUASI-QUOTED-BIVALENT-SYNTAX ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(pprint-coalton-codegen-types\n common-lisp:nil)\n\nWhat needs to change: Macro call that should be transformed by PPRINT-COALTON-CODEGEN-TYPES", "input": "(pprint-coalton-codegen-types\n common-lisp:nil)", "output": "(defmacro PPRINT-COALTON-CODEGEN-TYPES ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-inactive-layers nil\n (progn))\n\nIssue: Macro call that should be transformed by WITH-INACTIVE-LAYERS", "input": "(with-inactive-layers nil\n (progn))", "output": "(defmacro WITH-INACTIVE-LAYERS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(define-direct-binding nil\n nil)\n\nIssue: Macro call that should be transformed by DEFINE-DIRECT-BINDING", "input": "(define-direct-binding nil\n nil)", "output": "(defmacro define-direct-binding (name args &body body)\n (let ((env (or (lambda-fiddle:environment-lambda-var args) (gensym \"ENVIRONMENT\"))))\n `(progn (setf (binding ',name)\n (lambda ,(lambda-fiddle:remove-environment-part args)\n (let ((,env *environment*))\n (declare (ignorable ,env))\n ,@body)))\n ',name)))", "category": "dsl", "technique": "gensym", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(rem-arg-list-key-value! nil nil)\n\nIssue: Macro call that should be transformed by REM-ARG-LIST-KEY-VALUE!", "input": "(rem-arg-list-key-value! nil nil)", "output": "(defmacro rem-arg-list-key-value! (ids place &key (test '#'equalper) (key '#'identity))\n `(progn\n (iter (for id in (ensure-list ,ids))\n (setf ,place (rem-arg-list-key-value id ,place :test ,test :key ,key)))\n ,place))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(defmethod nil :key nil)\n\nProblem: Macro call that should be transformed by DEFMETHOD", "input": "(defmethod nil :key nil)", "output": "(defmacro DEFMETHOD ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(define-vari-function nil\n (progn))\n\nProblem: Macro call that should be transformed by DEFINE-VARI-FUNCTION", "input": "(define-vari-function nil\n (progn))", "output": "(defmacro define-vari-function (name args &body body)\n (check-args-for-constant-names :function name args)\n (destructuring-bind (in-args uniforms context shared)\n (split-arguments args '(&uniform &context &shared))\n (declare (ignore context))\n (assert (not shared) () 'shared-in-function :name name)\n `(progn\n (add-external-function ',name ',in-args ',uniforms ',body)\n ',name)))", "category": "dsl", "technique": "", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(fm-count-named nil (progn))\n\nProblem: Macro call that should be transformed by FM-COUNT-NAMED", "input": "(fm-count-named nil (progn))", "output": "(defmacro fm-count-named (family md-name &key (global-search t))\n `(length (fm-find-all ,family ,md-name\n :must-find nil\n :global-search ,global-search)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(translation-forms-for-class nil nil)\n\nProblem: Macro call that should be transformed by TRANSLATION-FORMS-FOR-CLASS", "input": "(translation-forms-for-class nil nil)", "output": "(defmacro translation-forms-for-class (class type-class)\n \"Make forms for translation of foreign structures to and from a standard class. The class slots are assumed to have the same name as the foreign structure.\"\n ;; Possible improvement: optional argument to map structure slot names to/from class slot names.\n `(progn\n (defmethod translate-from-foreign (pointer (type ,type-class))\n ;; Make the instance from the plist\n (apply 'make-instance ',class (call-next-method)))\n (defmethod translate-into-foreign-memory ((object ,class) (type ,type-class) pointer)\n (call-next-method\n ;; Translate into a plist and call the general method\n (loop for slot being the hash-value of (structure-slots type)\n for name = (slot-name slot)\n append (list slot-name (slot-value object slot-name)))\n type\n pointer))))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(decide nil)\n\nProblem: Macro call that should be transformed by DECIDE", "input": "(decide nil)", "output": "(defmacro DECIDE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(eko nil (progn))\n\nProblem: Macro call that should be transformed by EKO", "input": "(eko nil (progn))", "output": "(defmacro eko ((&rest trcargs) &rest body)\n (let ((result (gensym)))\n `(let ((,result ,@body))\n ,(if (stringp (car trcargs))\n `(trc ,(car trcargs) :=> ,result ,@(cdr trcargs))\n `(trc ,(car trcargs) ,(cadr trcargs) :=> ,result ,@(cddr trcargs)))\n ,result)))", "category": "control-flow", "technique": "gensym", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(defvar-unbound nil\n nil)\n\nProblem: Macro call that should be transformed by DEFVAR-UNBOUND", "input": "(defvar-unbound nil\n nil)", "output": "(defmacro defvar-unbound (var &body (docstring))\n \"Define VAR as if by `defvar' with no init form, and set DOCSTRING\nas its documentation.\n\nI believe the name comes from Edi Weitz.\"\n `(progn\n (defvar ,var)\n (setf (documentation ',var 'variable) ,docstring)\n ',var))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(multiple-value-match nil\n nil)\n\nWhat needs to change: Macro call that should be transformed by MULTIPLE-VALUE-MATCH", "input": "(multiple-value-match nil\n nil)", "output": "(defmacro multiple-value-match (values-form &body clauses)\n \"Matches the multiple values of VALUES-FORM with CLAUSES. Unlike\nMATCH, CLAUSES have to have the form of (PATTERNS . BODY), where\nPATTERNS is a list of patterns. The number of values that will be used\nto match is determined by the maximum arity of PATTERNS among CLAUSES.\n\nExamples:\n\n (multiple-value-match (values 1 2)\n ((2) 1)\n ((1 y) y))\n => 2\"\n (compile-multiple-value-match values-form clauses nil))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.8999999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(defsyntax nil\n :key\n nil)\n\nProblem: Macro call that should be transformed by DEFSYNTAX", "input": "(defsyntax nil\n :key\n nil)", "output": "(defmacro defsyntax (name &body options)\n `(progn\n (setf (get ',name :options) ',options)\n (defvar ,name (defreadtable ,name ,@options))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(ignore-errors nil nil)\n\nWhat needs to change: Macro call that should be transformed by IGNORE-ERRORS", "input": "(ignore-errors nil nil)", "output": "(defmacro IGNORE-ERRORS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(c-formula nil\n nil)\n\nWhat needs to change: Macro call that should be transformed by C-FORMULA", "input": "(c-formula nil\n nil)", "output": "(defmacro c-formula ((&rest keys &key lazy &allow-other-keys) &body forms)\n (assert (member lazy '(nil t :once-asked :until-asked :always)))\n `(make-c-dependent\n :code ',forms\n :value-state :unevaluated\n :rule (c-lambda ,@forms)\n ,@keys))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(.< common-lisp:nil common-lisp:nil)\n\nPattern to recognize: Macro call that should be transformed by .<", "input": "(.< common-lisp:nil common-lisp:nil)", "output": "(defmacro .< (cl:&rest items)\n \"Right associative compose operator. Creates a new functions that will run the\nfunctions right to left when applied. This is the same as the `nest` macro without supplying\nthe value. The composition is thus the same order as `compose`.\n\n`(.< f g h)` creates the function `(fn (x) (f (g (h x))))`.\"\n (alexandria:with-gensyms (x)\n `(fn (,x)\n (nest ,@items ,x))))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.85}
{"instruction": "Generate a defmacro form that transforms code like this:\n(with-context-variables nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by WITH-CONTEXT-VARIABLES", "input": "(with-context-variables nil\n nil)", "output": "(defmacro with-context-variables ((&rest vars) &body body)\n `(symbol-macrolet\n ,(loop for var in vars\n for form = `(context ,(intern (string var) :keyword))\n collect `(,var ,form))\n ,@body))", "category": "dispatch", "technique": "symbol-macrolet", "complexity": "basic", "quality_score": 0.8825}
{"instruction": "Generate a defmacro form that transforms code like this:\n(getsethash nil :key nil)\n\nPattern to recognize: Macro call that should be transformed by GETSETHASH", "input": "(getsethash nil :key nil)", "output": "(defmacro getsethash (key table new-value)\n \"Either get the value from TABLE by KEY or set a new calculated NEW-VALUE\n there and return it.\n It's similar to GETHASH called with 3 parameteres, but functions lazily.\"\n (once-only (key table)\n (with-gensyms (val in#)\n `(multiple-value-bind (,val ,in#) (gethash ,key ,table)\n (if ,in# ,val\n (sethash ,key ,table ,new-value))))))", "category": "anaphoric", "technique": "once-only,gensym,anaphor", "complexity": "intermediate", "quality_score": 0.7975}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(c?\n nil)\n\nWhat needs to change: Macro call that should be transformed by C?", "input": "(c?\n nil)", "output": "(defmacro c? (&body body)\n `(make-c-dependent\n :code ',body\n :value-state :unevaluated\n :rule (c-lambda ,@body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(ematch* common-lisp:nil\n :key\n common-lisp:nil)\n\nProblem: Macro call that should be transformed by EMATCH*", "input": "(ematch* common-lisp:nil\n :key\n common-lisp:nil)", "output": "(defmacro ematch* (whats &body clauses)\n #.+match*-doc+\n (let ((temps (make-gensyms whats \"OTHERWISE\")))\n `(match2* ,whats\n ,@clauses\n (,temps\n (error 'match-error :pattern ',clauses :values (list ,@temps))))))", "category": "control-flow", "technique": "gensym", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(unwrap-as common-lisp:nil)\n\nWhat needs to change: Macro call that should be transformed by UNWRAP-AS", "input": "(unwrap-as common-lisp:nil)", "output": "(defmacro unwrap-as (type cl:&optional (expr cl:nil expr-supplied-p))\n \"A syntactic convenience for type casting.\n\n (unwrap-as <type> <expr>)\n\nis equivalent to\n\n (the <type> (uwrap (tryInto <expr>)))\n\nand\n\n (unwrap-as <type>)\n\nis equivalent to\n\n (fn (expr) (the <type> (unwrap (tryInto expr)))).\n\nNote that this may copy the object or allocate memory.\"\n\n (cl:let ((try-into (cl:ignore-errors (cl:find-symbol \"TRYINTO\" \"COALTON/CLASSES\")))\n (unwrap (cl:ignore-errors (cl:find-symbol \"UNWRAP\" \"COALTON/CLASSES\"))))\n (cl:assert try-into () \"`try-as` macro does not have access to `try-into` yet.\")\n (cl:assert unwrap () \"`unwrap` macro does not have access to `unwrap` yet.\")\n (cl:if expr-supplied-p\n `(the ,type (,unwrap (,try-into ,expr)))\n (alexandria:with-gensyms (lexpr)\n `(fn (,lexpr)\n (the ,type (,unwrap (,try-into ,lexpr))))))))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.835}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(defmethod* nil\n nil)\n\nIssue: Macro call that should be transformed by DEFMETHOD*", "input": "(defmethod* nil\n nil)", "output": "(defmacro DEFMETHOD* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(define-modf-rewrite nil\n (progn))\n\nWhat needs to change: Macro call that should be transformed by DEFINE-MODF-REWRITE", "input": "(define-modf-rewrite nil\n (progn))", "output": "(defmacro define-modf-rewrite (name (expr) &body body)\n \"Define a new rewrite rule. If a form starting with NAME is encountered, call\nthe defined function to return a form that we can deal with (i.e. one defined\nvia DEFINE-MODF-EXPANDER, DEFINE-MODF-FUNCTION, and DEFINE-MODF-METHOD).\"\n `(eval-when (:compile-toplevel :load-toplevel :execute)\n (setf (gethash ',name *modf-rewrites*)\n (lambda (,expr)\n ,@body))))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(ignoring nil\n (progn))\n\nIssue: Macro call that should be transformed by IGNORING", "input": "(ignoring nil\n (progn))", "output": "(defmacro ignoring (type &body body)\n \"DEPRECATED: use `alexandria:ignore-some-conditions' instead.\"\n (simple-style-warning \"~s is deprecated, use ~s instead\"\n 'ignoring 'ignore-some-conditions)\n `(ignore-some-conditions (,type)\n ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by WITH", "input": "(with nil\n (progn))", "output": "(defmacro WITH ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.6825}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(with-standard-input-syntax)\n\nWrite a macro that addresses: Macro call that should be transformed by WITH-STANDARD-INPUT-SYNTAX", "input": "(with-standard-input-syntax)", "output": "(defmacro with-standard-input-syntax (&body body)\n \"Like `with-standard-io-syntax', but only bind the variables that\ncontrol the reader, not the printer.\n\nThis may be preferable to using `with-standard-io-syntax' when loading\ndata, as it will not effect how errors are printed, thus preserving\ndebugging information.\"\n (with-thunk ((body :name with-standard-input-syntax))\n `(call/standard-input-syntax ,body)))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(dynamic-progv nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by DYNAMIC-PROGV", "input": "(dynamic-progv nil\n :key\n nil)", "output": "(defmacro DYNAMIC-PROGV ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(minf nil (progn))\n\nPattern to recognize: Macro call that should be transformed by MINF", "input": "(minf nil (progn))", "output": "(defmacro MINF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(synchronized nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by SYNCHRONIZED", "input": "(synchronized nil\n :key\n nil)", "output": "(defmacro synchronized ((&optional (object nil objectp)) &body body &environment env)\n \"Run BODY holding a unique lock associated with OBJECT.\nIf no OBJECT is provided, run BODY as an anonymous critical section.\n\nIf BODY begins with a literal string, attach the string to the lock\nobject created (as the argument to `bt:make-recursive-lock').\"\n (multiple-value-bind (string? body)\n (if (stringp (first body))\n (values (first body) (rest body))\n (values nil body))\n (let* ((form (lock-form object objectp env string?)))\n (with-gensyms (lock)\n `(let ((,lock ,form))\n (bt:with-recursive-lock-held (,lock)\n ;; On some Lisps this would return T if empty.\n ,@(or body '(nil))))))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "intermediate", "quality_score": 0.8125}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(scase nil)\n\nWhat needs to change: Macro call that should be transformed by SCASE", "input": "(scase nil)", "output": "(defmacro scase (keyform &body cases)\n \"Like CASE, except binds the keyform to IT (via SYMBOL-MACROLET) for the\nscope of the body. IT can be set with SETF.\"\n `(symbolic case ,keyform ,@cases))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(with-fixtures nil)\n\nProblem: Macro call that should be transformed by WITH-FIXTURES", "input": "(with-fixtures nil)", "output": "(defmacro with-fixtures (fixtures &body body)\n `(call-with-fixtures (lambda () ,@body) ,fixtures))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(bdd-typecase 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by BDD-TYPECASE", "input": "(bdd-typecase 'lol-gen::some-name)", "output": "(defmacro BDD-TYPECASE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(ematch* 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by EMATCH*", "input": "(ematch* 'lol-gen::some-name)", "output": "(defmacro ematch* (whats &body clauses)\n #.+match*-doc+\n (let ((temps (make-gensyms whats \"OTHERWISE\")))\n `(match2* ,whats\n ,@clauses\n (,temps\n (error 'match-error :pattern ',clauses :values (list ,@temps))))))", "category": "control-flow", "technique": "gensym", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(with-unique-names 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by WITH-UNIQUE-NAMES", "input": "(with-unique-names 'lol-gen::some-name)", "output": "(defmacro WITH-UNIQUE-NAMES ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(def-suite nil)\n\nPattern to recognize: Macro call that should be transformed by DEF-SUITE", "input": "(def-suite nil)", "output": "(defmacro def-suite (name &key description in)\n \"Define a new test-suite named NAME.\n\nIN (a symbol), if provided, causes this suite te be nested in the\nsuite named by IN. NB: This macro is built on top of make-suite,\nas such it, like make-suite, will overrwrite any existing suite\nnamed NAME.\"\n `(eval-when (:compile-toplevel :load-toplevel :execute)\n (make-suite ',name\n ,@(when description `(:description ,description))\n ,@(when in `(:in ',in)))\n ',name))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(from nil)\n\nWrite a macro that addresses: Macro call that should be transformed by FROM", "input": "(from nil)", "output": "(defmacro from (&rest statements)\n `(make-clause :from ,@(mapcar #'expand-op statements)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(for-effects\n nil\n nil)\n\nProblem: Macro call that should be transformed by FOR-EFFECTS", "input": "(for-effects\n nil\n nil)", "output": "(defmacro FOR-EFFECTS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(set-bop nil nil)\n\nIssue: Macro call that should be transformed by SET-BOP", "input": "(set-bop nil nil)", "output": "(defmacro SET-BOP ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(with-special-initargs* nil\n :key\n nil)\n\nIssue: Macro call that should be transformed by WITH-SPECIAL-INITARGS*", "input": "(with-special-initargs* nil\n :key\n nil)", "output": "(defmacro WITH-SPECIAL-INITARGS* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(xor nil :key nil)\n\nWrite a macro that addresses: Macro call that should be transformed by XOR", "input": "(xor nil :key nil)", "output": "(defmacro xor (&rest datums)\n \"Evaluates its arguments one at a time, from left to right. If more than one\nargument evaluates to a true value no further DATUMS are evaluated, and NIL is\nreturned as both primary and secondary value. If exactly one argument\nevaluates to true, its value is returned as the primary value after all the\narguments have been evaluated, and T is returned as the secondary value. If no\narguments evaluate to true NIL is returned as primary, and T as secondary\nvalue.\"\n (with-gensyms (xor tmp true)\n `(let (,tmp ,true)\n (declare (ignorable ,tmp))\n (block ,xor\n ,@(mapcar (lambda (datum)\n `(if (setf ,tmp ,datum)\n (if ,true\n (return-from ,xor (values nil nil))\n (setf ,true ,tmp))))\n datums)\n (return-from ,xor (values ,true t))))))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.835}
{"instruction": "Generate a defmacro form that transforms code like this:\n(while nil)\n\nPattern to recognize: Macro call that should be transformed by WHILE", "input": "(while nil)", "output": "(defmacro WHILE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(dolist (quote lol-gen::some-name))\n\nIssue: Macro call that should be transformed by DOLIST", "input": "(dolist (quote lol-gen::some-name))", "output": "(defmacro DOLIST ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(.>)\n\nIssue: Macro call that should be transformed by .>", "input": "(.>)", "output": "(defmacro .> (cl:&rest items)\n \"Left associative compose operator. Creates a new functions that will run the\nfunctions left to right when applied. This is the same as the `pipe` macro without supplying\nthe value. The composition is thus the reverse order of `compose`.\n\n`(.> f g h)` creates the function `(fn (x) (h (g (f x))))`.\"\n (alexandria:with-gensyms (x)\n `(fn (,x)\n (pipe ,x ,@items))))", "category": "anaphoric", "technique": "gensym,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.835}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(cond-> nil)\n\nWrite a macro that addresses: Macro call that should be transformed by COND->", "input": "(cond-> nil)", "output": "(defmacro COND-> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(match2 common-lisp:nil\n (common-lisp:progn))\n\nWhat needs to change: Macro call that should be transformed by MATCH2", "input": "(match2 common-lisp:nil\n (common-lisp:progn))", "output": "(defmacro match2 (what &body clauses)\n \"In match2/match2*, the last clause is not enclosed in a block.\nTherefore, using `next' in the last clause results in jumping to the next innermost matching construct,\nor results in a compilation error when this is the outermost matching construct.\"\n `(match2+ ,what t ,@clauses))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "intermediate", "quality_score": 0.8999999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(finishes)\n\nPattern to recognize: Macro call that should be transformed by FINISHES", "input": "(finishes)", "output": "(defmacro finishes (&body body)\n \"Generates a pass if BODY executes to normal completion. In\nother words if body does signal, return-from or throw this test\nfails.\"\n `(unwind-protect-case () (progn ,@body)\n (:normal (add-result 'test-passed :test-expr ',body))\n (:abort (process-failure ',body \"Test didn't finish\"))))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(with-open-files nil\n (progn))\n\nProblem: Macro call that should be transformed by WITH-OPEN-FILES", "input": "(with-open-files nil\n (progn))", "output": "(defmacro with-open-files ((&rest args) &body body)\n \"A simple macro to open one or more files providing the streams for the BODY. The ARGS is a list of `(stream filespec options*)` as supplied to WITH-OPEN-FILE.\"\n (case (length args)\n ((0)\n `(progn ,@body))\n ((1)\n `(with-open-file ,(first args) ,@body))\n (t `(with-open-file ,(first args)\n (with-open-files\n ,(rest args) ,@body)))))", "category": "dsl", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.8999999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(actypecase nil\n (progn))\n\nPattern to recognize: Macro call that should be transformed by ACTYPECASE", "input": "(actypecase nil\n (progn))", "output": "(defmacro actypecase (keyform &body cases)\n \"Like CTYPECASE, except binds the result of the keyform to IT (via LET) for\nthe scope of the cases. Unlike CTYPECASE, new values possible stored by the\nSTORE-VALUE restart are not received by the keyform/place, but by IT.\"\n `(anaphoric ctypecase ,keyform ,@cases))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(bind nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by BIND", "input": "(bind nil\n nil)", "output": "(defmacro bind ((&rest bindings) &body body)\n \"Bind is a replacement for let*, destructuring-bind, multiple-value-bind and more. \n\nAn example is probably the best way to describe its syntax:\n\n \\(bind \\(\\(a 2\\)\n \\(\\(b &rest args &key \\(c 2\\) &allow-other-keys\\) '\\(:a :c 5 :d 10 :e 54\\)\\)\n \\(\\(:values d e\\) \\(truncate 4.5\\)\\)\n \\(\\(:structure xxx- slot1 slot2\\) \\(make-xxx\\)\\)\n \\(\\(:flet name \\(arg1 arg2\\)\\) \\(+ arg1 arg2\\)\\)\\)\n \\(list a b c d e args\\)\\)\n\nSimple bindings are as in let*. Destructuring is done if the first item\nin a binding is a list. Multiple value binding is done if the first item\nin a binding is a list and the first item in the list is ':values'. Other\nforms have their own syntax. For example, :structure first has the conc\nname and then slot names whereas :flet has the function name and a list\nof arguments and then the function body (in an implicit progn).\"\n (let (declarations)\n (loop while (and (consp (car body)) (eq (caar body) 'declare)) do\n (push (first body) declarations)\n (setf body (rest body)))\n (if bindings\n\t(let ((*all-declarations* (bind-expand-declarations (nreverse declarations))))\n\t (prog1\n\t (bind-macro-helper bindings body)\n\t (check-for-unused-variable-declarations *all-declarations*)))\n `(locally\n ,@declarations\n ,@body))))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(define-method-combination nil nil)\n\nProblem: Macro call that should be transformed by DEFINE-METHOD-COMBINATION", "input": "(define-method-combination nil nil)", "output": "(defmacro define-method-combination (name &rest args)\n `(progn\n (define-method-combination% ,name ,@args)\n (c2mop:define-method-combination ,name ,@args)))", "category": "dsl", "technique": "recursive-expansion", "complexity": "intermediate", "quality_score": 0.8999999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(group-by nil)\n\nProblem: Macro call that should be transformed by GROUP-BY", "input": "(group-by nil)", "output": "(defmacro group-by (&rest expressions)\n `(apply #'make-clause :group-by ',expressions))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(awhen nil\n (progn))\n\nPattern to recognize: Macro call that should be transformed by AWHEN", "input": "(awhen nil\n (progn))", "output": "(defmacro AWHEN ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(dictq)\n\nWrite a macro that addresses: Macro call that should be transformed by DICTQ", "input": "(dictq)", "output": "(defmacro dictq (&rest keys-and-values)\n \"A literal hash table.\nLike `dict', but the keys and values are implicitly quoted, and the\nhash table is inlined as a literal object.\"\n (apply #'dict keys-and-values))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(define-alias nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by DEFINE-ALIAS", "input": "(define-alias nil\n nil)", "output": "(defmacro DEFINE-ALIAS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(define-hook-generic nil :key nil)\n\nWrite a macro that addresses: Macro call that should be transformed by DEFINE-HOOK-GENERIC", "input": "(define-hook-generic nil :key nil)", "output": "(defmacro define-hook-generic (name gf-lambda-list &rest options)\n \"utility to help with gf's with method combination by remembering the combination type\n\nby default the combination type becomes the default qualifier for any newly defined hooks\nthis can be overriden by not using this and using defgeneric or supplying\nthe option :default-qualifier.\n\nsupplying `:hook-point t` will create a method qualified with the default-qualifier\nso that the generic acts like an extensible hook point and will not signal\nno-applicable-method error when no hooks have been defined.\n\nSee defhook\"\n (let* ((combination-option (find :method-combination options :key #'car :test #'eql))\n (combination-type\n (cond ((null combination-option) 'progn)\n ((null (cadr combination-option)) :unqualified)\n ((eql 'standard (cadr combination-option)) :unqualified)\n (t (cadr combination-option))))\n (default-qualifier\n (let ((d (cadr (find :default-qualifier options :key #'car :test #'eql))))\n (if (null d) combination-type d)))\n (hook-point (find :hook-point options :key #'car)))\n\n (intern-hook-generic name combination-type default-qualifier)\n `(progn (intern-hook-generic ',name ',combination-type ',default-qualifier)\n (defgeneric ,name ,gf-lambda-list\n ,@ (remove-if (lambda (s) (or (eql s :method-combination)\n (eql s :default-qualifier)\n (eql s :hook-point)))\n options :key #'car)\n (:method-combination\n ,(if (eql :unqualified combination-type) 'standard combination-type)))\n\n ,(when hook-point\n (remove :unqualified `(defmethod ,name ,default-qualifier ,gf-lambda-list)\n :end 3)))))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(defvariant nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by DEFVARIANT", "input": "(defvariant nil\n nil)", "output": "(defmacro DEFVARIANT ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(xml nil :key nil)\n\nPattern to recognize: Macro call that should be transformed by XML", "input": "(xml nil :key nil)", "output": "(defmacro xml (&rest tags)\n `(with-doctype :xml\n (loop for tag in ',tags\n append (tag->string tag))))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(emit nil)\n\nProblem: Macro call that should be transformed by EMIT", "input": "(emit nil)", "output": "(defmacro EMIT ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(sql 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by SQL", "input": "(sql 'lol-gen::some-name)", "output": "(defmacro sql (form)\n \"Convert the given form (a list starting with a keyword) to an SQL query\nstring at compile time, according to the rules described here. For example:\n\n (sql (:select '* :from 'country :where (:= 'a 1)))\n \\\"(SELECT * FROM country WHERE (a = 1))\\\"\n\nbut\n\n (sql '(:select '* :from 'country :where (:= 'a 1)))\n\nwould throw an error. For the later case you need to use sql-compile.\"\n (let ((list (reduce-strings (sql-expand form))))\n (if (= 1 (length list))\n (car list)\n `(strcat (list ,@list)))))", "category": "dsl", "technique": "recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(when-bind 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by WHEN-BIND", "input": "(when-bind 'lol-gen::some-name)", "output": "(defmacro WHEN-BIND ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(is-true nil nil)\n\nWrite a macro that addresses: Macro call that should be transformed by IS-TRUE", "input": "(is-true nil nil)", "output": "(defmacro is-true (condition &rest reason-args)\n \"Like IS this check generates a pass if CONDITION returns true\n and a failure if CONDITION returns false. Unlike IS this check\n does not inspect CONDITION to determine how to report the\n failure.\"\n `(if ,condition\n (add-result 'test-passed :test-expr ',condition)\n (process-failure ',condition\n ,@(or reason-args\n `(\"~S did not return a true value\" ',condition)))))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(ok nil nil)\n\nIssue: Macro call that should be transformed by OK", "input": "(ok nil nil)", "output": "(defmacro ok (test &optional desc)\n (with-gensyms (duration result)\n (once-only (test desc)\n `(with-catching-errors (:expected T :description ,desc)\n (with-duration ((,duration ,result) ,test)\n (test ,result t ,desc\n :duration ,duration\n :test-fn (lambda (x y)\n (eq (not (null x)) y))\n :got-form ,test))))))", "category": "capture-management", "technique": "once-only,gensym", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(nreversef 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by NREVERSEF", "input": "(nreversef 'lol-gen::some-name)", "output": "(defmacro NREVERSEF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(as->* nil\n :key\n nil)\n\nPattern to recognize: Macro call that should be transformed by AS->*", "input": "(as->* nil\n :key\n nil)", "output": "(defmacro AS->* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(~>> 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by ~>>", "input": "(~>> 'lol-gen::some-name)", "output": "(defmacro ~>> (needle &rest holes)\n \"Like `~>' but, by default, thread NEEDLE as the last argument\ninstead of the first.\"\n (thread-aux '~>> needle holes\n (lambda (needle hole)\n (append hole (list needle)))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(known? nil)\n\nProblem: Macro call that should be transformed by KNOWN?", "input": "(known? nil)", "output": "(defmacro KNOWN? ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(defsyntax nil)\n\nWrite a macro that addresses: Macro call that should be transformed by DEFSYNTAX", "input": "(defsyntax nil)", "output": "(defmacro defsyntax (name &body options)\n `(progn\n (setf (get ',name :options) ',options)\n (defvar ,name (defreadtable ,name ,@options))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(reduced-typecase nil nil)\n\nIssue: Macro call that should be transformed by REDUCED-TYPECASE", "input": "(reduced-typecase nil nil)", "output": "(defmacro REDUCED-TYPECASE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(select-dao nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by SELECT-DAO", "input": "(select-dao nil\n :key\n nil)", "output": "(defmacro select-dao (class &body clauses)\n \"Build custom queries with SxQL.\n\nExample:\n\n (select-dao 'tweet\n (where (:like :status \\\"%Japan%\\\")))\n\nYou can use \\\"includes\\\" to eagerly load another table and prevent the \\\"N+1 query\\\" performance problem:\n\n (select-dao 'tweet\n (includes 'user)\n (where (:like :status \\\"%Japan%\\\")))\n\nYou can use \\\"joins\\\" to add JOIN clauses for filtering by related table columns.\nNote: \\\"joins\\\" does NOT automatically load foreign objects. Use \\\"includes\\\" if you need the ghost slots populated:\n\n ;; Filter by related table - ghost slot NOT populated\n (select-dao 'blog\n (joins 'user)\n (where (:= :user.status \\\"active\\\")))\n\n ;; Filter AND load foreign objects\n (select-dao 'blog\n (joins 'user)\n (includes 'user)\n (where (:= :user.status \\\"active\\\")))\n\nSee the SxQL documentation for the available clauses and operators.\"\n (with-gensyms (sql clause results include-classes foreign-class)\n (once-only (class)\n `(#+sb-package-locks locally #+sb-package-locks (declare (sb-ext:disable-package-locks sxql:where))\n #-sb-package-locks cl-package-locks:with-packages-unlocked #-sb-package-locks (sxql)\n (progn\n (setf ,class (ensure-class ,class))\n (let* ((sxql:*sql-symbol-conversion* #'unlispify)\n (,sql\n (sxql:select :*\n (sxql:from (sxql:make-sql-symbol (table-name ,class)))))\n (,include-classes '()))\n (macrolet ((where (expression)\n `(sxql:make-clause :where ,(expand-op expression ',class))))\n ;; ignore compiler-note when includes is not used\n #+sbcl (declare (sb-ext:muffle-conditions sb-ext:code-deletion-note))\n (flet ((includes (&rest classes)\n (appendf ,include-classes (mapcar #'ensure-class classes))\n nil)\n (joins (foreign-class &key (type :inner))\n (let ((foreign-class (ensure-class foreign-class)))\n (add-child ,sql\n (ecase type\n (:inner (sxql:inner-join\n (sxql:make-sql-symbol (table-name foreign-class))\n :on (make-join-condition ,class foreign-class)))\n (:left (sxql:left-join\n (sxql:make-sql-symbol (table-name foreign-class))\n :on (make-join-condition ,class foreign-class)))))\n nil)))\n (dolist (,clause (list ,@clauses))\n (when ,clause\n (add-child ,sql ,clause)))\n (let ((,results (select-by-sql ,class ,sql)))\n (unless *want-cursor*\n (dolist (,foreign-class (remove-duplicates ,include-classes))\n (include-foreign-objects ,foreign-class ,results)))\n (values ,results ,sql))))))))))", "category": "capture-management", "technique": "macrolet,once-only,gensym,recursive-expansion", "complexity": "advanced", "quality_score": 0.9099999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(lazy-seq 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by LAZY-SEQ", "input": "(lazy-seq 'lol-gen::some-name)", "output": "(defmacro lazy-seq (head &optional tail)\n \"Creates a `LAZY-SEQ' where HEAD is the first element in the\n sequence and TAIL is a form which computes the remainder of the\n sequence. TAIL is wrapped in a function that stores the result of\n evaluating FORM, the first time it is invoked, and returns the\n stored result in future invocations.\"\n\n `(make-lazy-seq :head ,head :tail (thunk ,tail)))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(ftype common-lisp:nil\n (common-lisp:progn))\n\nProblem: Macro call that should be transformed by FTYPE", "input": "(ftype common-lisp:nil\n (common-lisp:progn))", "output": "(defmacro FTYPE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(with-object nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by WITH-OBJECT", "input": "(with-object nil\n :key\n nil)", "output": "(defmacro with-object ((&optional (stream '*json-output*)) &body body)\n \"Open a JSON Object, run BODY, then close the Object. Inside the BODY,\nAS-OBJECT-MEMBER or ENCODE-OBJECT-MEMBER should be called to encode\nMembers of the Object.\"\n `(with-aggregate (object #\\{ #\\} ,stream) ,@body))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(with-decoder-simple-list-semantics)\n\nProblem: Macro call that should be transformed by WITH-DECODER-SIMPLE-LIST-SEMANTICS", "input": "(with-decoder-simple-list-semantics)", "output": "(defmacro with-decoder-simple-list-semantics (&body body)\n \"Execute BODY in a dynamic environement where the decoder semantics\nis such as set by SET-DECODER-SIMPLE-LIST-SEMANTICS.\"\n `(with-shadowed-custom-vars\n (set-decoder-simple-list-semantics)\n ,@body))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(formatter nil)\n\nPattern to recognize: Macro call that should be transformed by FORMATTER", "input": "(formatter nil)", "output": "(defmacro FORMATTER ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(define-final-class nil :key nil)\n\nPattern to recognize: Macro call that should be transformed by DEFINE-FINAL-CLASS", "input": "(define-final-class nil :key nil)", "output": "(defmacro DEFINE-FINAL-CLASS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(f_\n 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by F_", "input": "(f_\n 'lol-gen::some-name)", "output": "(defmacro F_ ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(lambda-match\n common-lisp:nil\n (common-lisp:progn))\n\nWhat needs to change: Macro call that should be transformed by LAMBDA-MATCH", "input": "(lambda-match\n common-lisp:nil\n (common-lisp:progn))", "output": "(defmacro lambda-match (&body body)\n \"Equivalent to (lambda (arg) (match arg BODY...)).\"\n (multiple-value-bind (preamble clauses) (parse-matcher-body body)\n (with-gensyms (clause)\n `(lambda (,clause)\n ,@preamble\n (match ,clause\n ,@clauses)))))", "category": "capture-management", "technique": "gensym", "complexity": "basic", "quality_score": 0.8999999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(dynamic-let nil)\n\nWrite a macro that addresses: Macro call that should be transformed by DYNAMIC-LET", "input": "(dynamic-let nil)", "output": "(defmacro DYNAMIC-LET ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(cond-let 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by COND-LET", "input": "(cond-let 'lol-gen::some-name)", "output": "(defmacro cond-let (var &body body)\n \"Like COND. VAR will be bound to the passed COND test.\"\n `(let (,var)\n (cond\n ,@(mapcar #``((setf ,var ,(car %)) ,(cadr %))\n ;; uses the fact, that SETF returns the value set\n body))))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(iter\n nil\n nil)\n\nProblem: Macro call that should be transformed by ITER", "input": "(iter\n nil\n nil)", "output": "(defmacro iter (&body body &environment env)\n \"Jonathan Amsterdam's powerful and extensible iteration facility,\nproviding multiple accumulation, generators, memory of previous\niterations, over 50 clauses to start with and a Lisp-like syntax.\nEvaluate (iter:display-iter-clauses) for an overview of clauses.\"\n (let* ((*env* env)\n (*result-var* (genvar 'result))\n (*type-alist* nil)\n (*declare-variables* *always-declare-variables*)\n (*bindings* nil)\n (*internal-variables* nil)\n (*previous-vars-alist* nil)\n (*declarations* nil)\n (*loop-body-wrappers* nil)\n (*accum-var-alist* nil)\n (*shared-bindings-alist* nil)\n (*top-level?* t)\n (*declaration-context?* nil)\n (*temps* nil)\n (*temps-in-use* nil)\n (*driver-info-alist* nil)\n (*block-name* (when (symbolp (car body))\n (pop body)))\n (*loop-top* (ensure-symbol *block-name* :format \"loop-top-~a\"))\n (*loop-step* (ensure-symbol *block-name* :format \"loop-step-~a\"))\n (*loop-end* (ensure-symbol *block-name* :format \"loop-end-~a\"))\n (*loop-step-used?* nil)\n (*loop-end-used?* nil))\n (process-top-level-decls body)\n (multiple-value-bind (body decls init-code steppers final-code final-prot)\n (walk-list body)\n (multiple-value-bind (init step)\n (insert-previous-code)\n (augment init-code init)\n (augment steppers step)\n (prepend (default-driver-code) body)\n (let ((it-bod `(block ,*block-name*\n (tagbody\n ,.init-code\n ,*loop-top*\n ,.body\n ,.(when *loop-step-used?* (list *loop-step*))\n ,.steppers\n (go ,*loop-top*)\n ,.(when *loop-end-used?* (list *loop-end*))\n ,.final-code)\n ,(if (member *result-var* *bindings* :key #'car)\n *result-var*\n nil))))\n (wrap-form *loop-body-wrappers*\n `(let* ,(nreverse *bindings*)\n ,.(if *declarations*\n `((declare .,*declarations*)))\n ,.decls\n ,(if final-prot\n `(unwind-protect ,it-bod .,final-prot)\n it-bod))))))))", "category": "anaphoric", "technique": "tagbody-go,anaphor,recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Generate a defmacro form that transforms code like this:\n(when-failing 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by WHEN-FAILING", "input": "(when-failing 'lol-gen::some-name)", "output": "(defmacro WHEN-FAILING ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(jwhen nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by JWHEN", "input": "(jwhen nil\n :key\n nil)", "output": "(defmacro jwhen (test &body body)\n \"JSON-aware version of `cl:when'.\nIf TEST is `jtruep' evaluate BODY.\"\n `(jif ,test\n (progn ,@body)))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(with-custom-decoder-level nil\n nil)\n\nWhat needs to change: Macro call that should be transformed by WITH-CUSTOM-DECODER-LEVEL", "input": "(with-custom-decoder-level nil\n nil)", "output": "(defmacro with-custom-decoder-level ((&rest customizations) &body body)\n \"Execute BODY in a dynamic environment such that, when nested\nstructures are decoded, the outermost level is decoded with the given\ncustom handlers (CUSTOMIZATIONS) whereas inner levels are decoded in\nthe usual way.\"\n `(let ((current-decoder\n (current-decoder\n ,@(loop for (key value) on customizations by #'cddr\n if (eq key :internal-decoder)\n do (error \"~S ~S customization is meaningless in ~\n the context of WITH-CUSTOM-DECODER-LEVEL.\"\n key value)\n else collect key))))\n (bind-custom-vars (:internal-decoder current-decoder ,@customizations)\n ,@body)))", "category": "dsl", "technique": "", "complexity": "intermediate", "quality_score": 0.875}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(pprint-coalton-codegen-types\n common-lisp:nil\n :key\n common-lisp:nil)\n\nProblem: Macro call that should be transformed by PPRINT-COALTON-CODEGEN-TYPES", "input": "(pprint-coalton-codegen-types\n common-lisp:nil\n :key\n common-lisp:nil)", "output": "(defmacro PPRINT-COALTON-CODEGEN-TYPES ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8049999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(emit 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by EMIT", "input": "(emit 'lol-gen::some-name)", "output": "(defmacro EMIT ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(defmethod* nil (progn))\n\nIssue: Macro call that should be transformed by DEFMETHOD*", "input": "(defmethod* nil (progn))", "output": "(defmacro DEFMETHOD* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(c?? nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by C??", "input": "(c?? nil\n nil)", "output": "(defmacro c?? ((&key (tagp nil) (in nil) (out t))&body body)\n (let ((result (copy-symbol 'result))\n (thetag (gensym)))\n `(make-c-dependent\n :code ',body\n :value-state :unevaluated\n :rule (c-lambda\n (let ((,thetag (gensym \"tag\"))\n (*trcdepth* (1+ *trcdepth*))\n )\n (declare (ignorable self ,thetag))\n ,(when in\n `(trc \"c??> entry\" (c-slot-name c) (c-model c) (when ,tagp ,thetag)))\n (count-it :c?? (c-slot-name c) (md-name (c-model c)))\n (let ((,result (progn ,@body)))\n ,(when out `(trc \"c?? result:\" ,result (c-slot-name c) (when ,tagp ,thetag)))\n ,result))))))", "category": "anaphoric", "technique": "gensym,anaphor", "complexity": "intermediate", "quality_score": 0.7975}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(with-rules nil\n :key\n nil)\n\nProblem: Macro call that should be transformed by WITH-RULES", "input": "(with-rules nil\n :key\n nil)", "output": "(defmacro WITH-RULES ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(coalton-codegen)\n\nIssue: Macro call that should be transformed by COALTON-CODEGEN", "input": "(coalton-codegen)", "output": "(defmacro COALTON-CODEGEN ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(one-value nil)\n\nIssue: Macro call that should be transformed by ONE-VALUE", "input": "(one-value nil)", "output": "(defmacro ONE-VALUE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(defmessage nil nil)\n\nWrite a macro that addresses: Macro call that should be transformed by DEFMESSAGE", "input": "(defmessage nil nil)", "output": "(defmacro DEFMESSAGE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(lambda-coro\n nil\n nil)\n\nPattern to recognize: Macro call that should be transformed by LAMBDA-CORO", "input": "(lambda-coro\n nil\n nil)", "output": "(defmacro LAMBDA-CORO ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(aif nil (progn))\n\nWhat needs to change: Macro call that should be transformed by AIF", "input": "(aif nil (progn))", "output": "(defmacro aif (test then &optional else)\n \"Like IF, except binds the result of the test to IT (via LET) for\nthe scope of the then and else expressions.\" \n `(anaphoric if ,test ,then ,else))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(next-in nil :key nil)\n\nWhat needs to change: Macro call that should be transformed by NEXT-IN", "input": "(next-in nil :key nil)", "output": "(defmacro NEXT-IN ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(is-every nil)\n\nPattern to recognize: Macro call that should be transformed by IS-EVERY", "input": "(is-every nil)", "output": "(defmacro is-every (predicate &body clauses)\n \"The input is either a list of lists, or a list of pairs. Generates (is (,predicate ,expr ,value))\n for each pair of elements or (is (,predicate ,expr ,value) ,@reason) for each list.\"\n `(progn\n ,@(if (every #'consp clauses)\n (loop for (expected actual . reason) in clauses\n collect `(is (,predicate ,expected ,actual) ,@reason))\n (progn\n (assert (evenp (list-length clauses)))\n (loop for (expr value) on clauses by #'cddr\n collect `(is (,predicate ,expr ,value)))))))", "category": "control-flow", "technique": "", "complexity": "intermediate", "quality_score": 0.79}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(make-list common-lisp:nil (common-lisp:progn))\n\nIssue: Macro call that should be transformed by MAKE-LIST", "input": "(make-list common-lisp:nil (common-lisp:progn))", "output": "(defmacro make-list (cl:&rest forms)\n \"Create a heterogeneous Coalton `List` of objects. This macro is\ndeprecated; use `coalton/list:make`.\"\n (cl:labels\n ((list-helper (forms)\n (cl:if (cl:endp forms)\n `coalton:Nil\n `(coalton:Cons ,(cl:car forms) ,(list-helper (cl:cdr forms))))))\n (list-helper forms)))", "category": "control-flow", "technique": "nested-backquote", "complexity": "advanced", "quality_score": 0.8999999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(ps-package-prefix 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by PS-PACKAGE-PREFIX", "input": "(ps-package-prefix 'lol-gen::some-name)", "output": "(defmacro PS-PACKAGE-PREFIX ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(left nil (progn))\n\nIssue: Macro call that should be transformed by LEFT", "input": "(left nil (progn))", "output": "(defmacro left (parser &rest parsers)\n \"Combination of parsers yielding the result of the leftmost one.\"\n `(<* ,parser ,@parsers))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(lambda ())\n\nProblem: Macro call that should be transformed by LAMBDA", "input": "(lambda ())", "output": "(defmacro LAMBDA ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(count-failures\n nil\n (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by COUNT-FAILURES", "input": "(count-failures\n nil\n (progn))", "output": "(defmacro COUNT-FAILURES ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(sor nil nil)\n\nWhat needs to change: Macro call that should be transformed by SOR", "input": "(sor nil nil)", "output": "(defmacro sor (first &rest rest)\n \"Like OR, except binds the first argument to IT (via SYMBOL-MACROLET) for\nthe scope of the rest of the arguments. IT can be set with SETF.\"\n `(symbolic or ,first ,@rest))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Generate a defmacro form that transforms code like this:\n(untrace nil nil)\n\nPattern to recognize: Macro call that should be transformed by UNTRACE", "input": "(untrace nil nil)", "output": "(defmacro UNTRACE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(some->> nil :key nil)\n\nProblem: Macro call that should be transformed by SOME->>", "input": "(some->> nil :key nil)", "output": "(defmacro SOME->> ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(~>> nil :key nil)\n\nPattern to recognize: Macro call that should be transformed by ~>>", "input": "(~>> nil :key nil)", "output": "(defmacro ~>> (needle &rest holes)\n \"Like `~>' but, by default, thread NEEDLE as the last argument\ninstead of the first.\"\n (thread-aux '~>> needle holes\n (lambda (needle hole)\n (append hole (list needle)))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(dynamic-extent common-lisp:nil\n (common-lisp:progn))\n\nWhat needs to change: Macro call that should be transformed by DYNAMIC-EXTENT", "input": "(dynamic-extent common-lisp:nil\n (common-lisp:progn))", "output": "(defmacro DYNAMIC-EXTENT ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8049999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n;; Macro with double-evaluation bug\n(defmacro square (x)\n `(* ,x ,x))\n;; (square (incf y)) evaluates (incf y) TWICE\n\n;; Manual fix requires gensym + let boilerplate every time\n(defmacro square (x)\n (let ((g (gensym)))\n `(let ((,g ,x))\n (* ,g ,g))))\n\nWhat needs to change: Macro arguments evaluated multiple times (double evaluation) \u2014 need automatic once-only that also provides both original form and evaluated value", "input": ";; Macro with double-evaluation bug\n(defmacro square (x)\n `(* ,x ,x))\n;; (square (incf y)) evaluates (incf y) TWICE\n\n;; Manual fix requires gensym + let boilerplate every time\n(defmacro square (x)\n (let ((g (gensym)))\n `(let ((,g ,x))\n (* ,g ,g))))", "output": "(defun o!-symbol-p (s)\n (and (symbolp s)\n (> (length (symbol-name s)) 2)\n (string= (symbol-name s)\n \"O!\"\n :start1 0\n :end1 2)))\n\n(defun o!-symbol-to-g!-symbol (s)\n (symb \"G!\"\n (subseq (symbol-name s) 2)))\n\n(defmacro defmacro! (name args &rest body)\n (let* ((os (remove-if-not #'o!-symbol-p (flatten args)))\n (gs (mapcar #'o!-symbol-to-g!-symbol os)))\n (multiple-value-bind (body declarations docstring)\n (parse-body body :documentation t)\n `(defmacro/g! ,name ,args\n ,@(when docstring\n (list docstring))\n ,@declarations\n `(let ,(mapcar #'list (list ,@gs) (list ,@os))\n ,(progn ,@body))))))", "category": "capture-management", "technique": "once-only,gensym", "complexity": "advanced", "quality_score": 0.9624999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(define-template nil nil)\n\nWrite a macro that addresses: Macro call that should be transformed by DEFINE-TEMPLATE", "input": "(define-template nil nil)", "output": "(defmacro DEFINE-TEMPLATE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(match nil\n nil)\n\nWrite a macro that addresses: Macro call that should be transformed by MATCH", "input": "(match nil\n nil)", "output": "(defmacro match (arg &body clauses)\n \"Matches ARG with CLAUSES. CLAUSES is a list of the form of (PATTERN\n. BODY) where PATTERN is a pattern specifier and BODY is an implicit\nprogn. If ARG matches some PATTERN, `match` then evaluates\nthe corresponding BODY and returns the evaluated value. If no pattern matches,\nthen returns NIL.\n\nEvaluating a form (FAIL) in the clause body causes the latest pattern\nmatching to fail. For example,\n\n (match 1\n (x (if (eql x 1)\n (fail)\n x))\n (_ 'ok))\n\nreturns OK, because the form (FAIL) in the first clause is\nevaluated.\n\nIf BODY starts with the symbols WHEN or UNLESS, then the next form\nwill be used to introduce (FAIL). That is,\n\n (match list ((list x) when (oddp x) x))\n (match list ((list x) unless (evenp x) x))\n\nwill be translated to\n\n (match list ((list x) (if (oddp x) x (fail))))\n (match list ((list x) (if (evenp x) (fail) x)))\n\nExamples:\n\n (match 1 (1 1))\n => 1\n (match 1 (2 2))\n => 2\n (match 1 (x x))\n => 1\n (match (list 1 2 3)\n (list x y z) (+ x y z))\n => 6\"\n (compile-match-1 arg clauses nil))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "advanced", "quality_score": 0.8975}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(defgenerator nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by DEFGENERATOR", "input": "(defgenerator nil\n :key\n nil)", "output": "(defmacro defgenerator (name arguments &body body)\n (multiple-value-bind (remaining-forms declarations doc-string)\n (alexandria:parse-body body :documentation t)\n `(defun ,name ,arguments\n ,doc-string\n ,@declarations\n (with-yield\n\t ,@remaining-forms))))", "category": "dsl", "technique": "", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(c_?)\n\nProblem: Macro call that should be transformed by C_?", "input": "(c_?)", "output": "(defmacro c_? (&body body)\n \"Lazy until asked, then eagerly propagating\"\n `(make-c-dependent\n :code ',body\n :value-state :unevaluated\n :lazy :until-asked\n :rule (c-lambda ,@body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(define-script-symbol-macro nil\n :key\n nil)\n\nWhat needs to change: Macro call that should be transformed by DEFINE-SCRIPT-SYMBOL-MACRO", "input": "(define-script-symbol-macro nil\n :key\n nil)", "output": "(defmacro DEFINE-SCRIPT-SYMBOL-MACRO ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(=> nil nil)\n\nWrite a macro that addresses: Macro call that should be transformed by =>", "input": "(=> nil nil)", "output": "(defmacro => (fn1 fn2 &rest fns)\n \"Function composition of FN1, FN2 and all the other FNS.\"\n (let ((arg (gensym \"ARG\")))\n `(lambda (,arg)\n ,(if fns\n `(,fn1 (call (=> ,fn2 ,@fns) ,arg))\n `(,fn1 (,fn2 ,arg))))))", "category": "control-flow", "technique": "gensym,recursive-expansion", "complexity": "intermediate", "quality_score": 0.885}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(with-unique-names nil\n :key\n nil)\n\nProblem: Macro call that should be transformed by WITH-UNIQUE-NAMES", "input": "(with-unique-names nil\n :key\n nil)", "output": "(defmacro WITH-UNIQUE-NAMES ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(make-name-transformer nil nil)\n\nWhat needs to change: Macro call that should be transformed by MAKE-NAME-TRANSFORMER", "input": "(make-name-transformer nil nil)", "output": "(defmacro make-name-transformer (&rest elements)\n \"Return an accessor name transformer.\nThe unquoted `name' symbol argument is substituted for the slot name.\nClass option examples:\n\n :accessor-name-transformer (make-name-transformer \\\"FOO-\\\" name \\\"-BAR\\\")\n\nUse the slot name directly:\n\n :accessor-name-transformer (make-name-transformer name)\"\n `(lambda (name definition)\n (declare (ignorable definition))\n (concatenate-symbol ,@(mapcar (lambda (el)\n (if (and (symbolp el)\n (string= (symbol-name el) \"NAME\"))\n 'name\n el))\n elements))))", "category": "control-flow", "technique": "recursive-expansion", "complexity": "advanced", "quality_score": 0.9125}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(compiler-macro-lambda nil\n :key\n nil)\n\nIssue: Macro call that should be transformed by COMPILER-MACRO-LAMBDA", "input": "(compiler-macro-lambda nil\n :key\n nil)", "output": "(defmacro compiler-macro-lambda (lambda-list &body body)\n (introspect-environment:parse-compiler-macro (gensym \"COMPILER-MACRO-LAMBDA\")\n lambda-list\n body))", "category": "control-flow", "technique": "gensym", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(doc common-lisp:nil\n :key\n common-lisp:nil)\n\nProblem: Macro call that should be transformed by DOC", "input": "(doc common-lisp:nil\n :key\n common-lisp:nil)", "output": "(defmacro DOC ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Generate a defmacro form that transforms code like this:\n(left-join 'lol-gen::some-name)\n\nPattern to recognize: Macro call that should be transformed by LEFT-JOIN", "input": "(left-join 'lol-gen::some-name)", "output": "(defmacro left-join (table &key on using)\n `(join ,table :kind :left :on ,on :using ,using))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(sum-of 'lol-gen::some-name)\n\nIssue: Macro call that should be transformed by SUM-OF", "input": "(sum-of 'lol-gen::some-name)", "output": "(defmacro SUM-OF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(filterf nil (progn))\n\nProblem: Macro call that should be transformed by FILTERF", "input": "(filterf nil (progn))", "output": "(defmacro FILTERF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(from nil :key nil)\n\nIssue: Macro call that should be transformed by FROM", "input": "(from nil :key nil)", "output": "(defmacro from (&rest statements)\n `(make-clause :from ,@(mapcar #'expand-op statements)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(ensure-list nil\n :key\n nil)\n\nProblem: Macro call that should be transformed by ENSURE-LIST", "input": "(ensure-list nil\n :key\n nil)", "output": "(defmacro ensure-list (item &body body)\n `(let ((,item (if (listp ,item) ,item '(,item))))\n ,@body))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8225}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(returning nil nil)\n\nWhat needs to change: Macro call that should be transformed by RETURNING", "input": "(returning nil nil)", "output": "(defmacro returning (&rest expressions)\n `(apply #'make-clause :returning\n (list ,@(mapcar (lambda (expr)\n (if (and (listp expr)\n (keywordp (car expr)))\n (expand-op expr)\n `,expr))\n expressions))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(remove-from-plistf nil nil)\n\nWrite a macro that addresses: Macro call that should be transformed by REMOVE-FROM-PLISTF", "input": "(remove-from-plistf nil nil)", "output": "(defmacro REMOVE-FROM-PLISTF ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(finishes\n nil\n :key\n nil)\n\nPattern to recognize: Macro call that should be transformed by FINISHES", "input": "(finishes\n nil\n :key\n nil)", "output": "(defmacro finishes (&body body)\n \"Generates a pass if BODY executes to normal completion. In\nother words if body does signal, return-from or throw this test\nfails.\"\n `(unwind-protect-case () (progn ,@body)\n (:normal (add-result 'test-passed :test-expr ',body))\n (:abort (process-failure ',body \"Test didn't finish\"))))", "category": "anaphoric", "technique": "anaphor", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(lambda-match\n 'lol-gen::some-name)\n\nWrite a macro that addresses: Macro call that should be transformed by LAMBDA-MATCH", "input": "(lambda-match\n 'lol-gen::some-name)", "output": "(defmacro lambda-match (&body body)\n \"Equivalent to (lambda (arg) (match arg BODY...)).\"\n (multiple-value-bind (preamble clauses) (parse-matcher-body body)\n (with-gensyms (clause)\n `(lambda (,clause)\n ,@preamble\n (match ,clause\n ,@clauses)))))", "category": "capture-management", "technique": "gensym", "complexity": "basic", "quality_score": 0.8624999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(^value)\n\nWrite a macro that addresses: Macro call that should be transformed by ^VALUE", "input": "(^value)", "output": "(defmacro ^VALUE ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(without-recursion nil)\n\nWrite a macro that addresses: Macro call that should be transformed by WITHOUT-RECURSION", "input": "(without-recursion nil)", "output": "(defmacro without-recursion ((&key) &body body)\n \"If BODY calls itself, at any depth, signal a (continuable) error of\ntype `recursion-forbidden'.\"\n (with-unique-names (recursion-id)\n `(progn\n (when (member ',recursion-id *recursions*)\n (cerror \"Recurse anyway.\"\n 'recursion-forbidden\n :form ',body))\n (let ((*recursions* (cons ',recursion-id *recursions*)))\n (declare (dynamic-extent *recursions*))\n ,@body))))", "category": "anaphoric", "technique": "anaphor", "complexity": "intermediate", "quality_score": 0.86}
{"instruction": "Write a Common Lisp macro to handle this code pattern:\n(lambda* nil\n (progn))\n\nProblem: Macro call that should be transformed by LAMBDA*", "input": "(lambda* nil\n (progn))", "output": "(defmacro LAMBDA* ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(function-call nil (progn))\n\nWhat needs to change: Macro call that should be transformed by FUNCTION-CALL", "input": "(function-call nil (progn))", "output": "(defmacro FUNCTION-CALL ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(compile-$flavor-$methods nil (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by COMPILE-$FLAVOR-$METHODS", "input": "(compile-$flavor-$methods nil (progn))", "output": "(defmacro COMPILE-$FLAVOR-$METHODS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7675}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(markup 'lol-gen::some-name)\n\nWhat needs to change: Macro call that should be transformed by MARKUP", "input": "(markup 'lol-gen::some-name)", "output": "(defmacro markup (&rest tags)\n `(%write-strings\n ,@(loop for tag in tags\n append (tag->string tag))))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(with-collectors nil\n (progn))\n\nWhat needs to change: Macro call that should be transformed by WITH-COLLECTORS", "input": "(with-collectors nil\n (progn))", "output": "(defmacro with-collectors ((&rest collectors) &body body)\n \"Like `with-collector', with multiple collectors.\nReturns the final value of each collector as multiple values.\n\n (with-collectors (x y z)\n (x 1)\n (y 2)\n (z 3))\n => '(1) '(2) '(3)\"\n ;; Warn if there are duplications in COLLECTORS.\n (when (> (length collectors)\n (length (remove-duplicates collectors)))\n (warn \"Duplicated collectors in with-collectors form: ~s\" collectors))\n (with-gensyms (outer)\n `(block ,outer\n ,(reduce (lambda (form collector)\n `(with-collector (,collector)\n ,form))\n collectors\n :initial-value\n `(progn\n ,@body\n (return-from ,outer\n (values ,@(mapcar #'list collectors))))))))", "category": "capture-management", "technique": "gensym,recursive-expansion", "complexity": "advanced", "quality_score": 0.9125}
{"instruction": "Define a macro that eliminates this repetitive pattern:\n(c?dbg)\n\nIssue: Macro call that should be transformed by C?DBG", "input": "(c?dbg)", "output": "(defmacro c?dbg (&body body)\n `(make-c-dependent\n :code ',body\n :value-state :unevaluated\n :debug t\n :rule (c-lambda ,@body)))", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.8474999999999999}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(nix nil (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by NIX", "input": "(nix nil (progn))", "output": "(defmacro nix (&rest places)\n \"Set PLACES to nil and return the old value(s) of PLACES.\n\nIf there is more than one PLACE, return their old values as multiple values.\n\nThis may be more efficient than (shiftf place nil), because it only\nsets PLACE when it is not already null.\"\n `(values\n ,@(loop for place in places\n collect `(nix-1 ,place))))", "category": "anaphoric", "technique": "anaphor,recursive-expansion", "complexity": "intermediate", "quality_score": 0.885}
{"instruction": "You are a Common Lisp macro expert. Given this code pattern:\n(prog1 nil (progn))\n\nWrite a macro that addresses: Macro call that should be transformed by PROG1", "input": "(prog1 nil (progn))", "output": "(defmacro PROG1 ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(export-constructors)\n\nWhat needs to change: Macro call that should be transformed by EXPORT-CONSTRUCTORS", "input": "(export-constructors)", "output": "(defmacro EXPORT-CONSTRUCTORS ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Generate a defmacro form that transforms code like this:\n(fn common-lisp:nil)\n\nPattern to recognize: Macro call that should be transformed by FN", "input": "(fn common-lisp:nil)", "output": "(defmacro FN ...)", "category": "control-flow", "technique": "", "complexity": "basic", "quality_score": 0.7525}
{"instruction": "Create a Common Lisp macro for the following transformation. Before code:\n(define-switch)\n\nWhat needs to change: Macro call that should be transformed by DEFINE-SWITCH", "input": "(define-switch)", "output": "(defmacro define-switch (&key name macro-character)\n \"Define a c-mera reader switch (in repl)\n allowing preprocessing and mixed case\"\n `(defun ,name (&key (debug nil))\n (cond ((eql *c-mera-reader* 'cl)\n\t (setf *c-mera-reader* 'cm)\n\t ;; TODO when debug\n\t ,@macro-character\n\t (setf (readtable-case *readtable*) :invert))\n\t ((eql *c-mera-reader* 'cm)\n\t (setf *c-mera-reader* 'cl)\n\t (setf *readtable* *readtable-backup*))\n\t (t (error \"Unknown c-mera reader status: ~a\" *c-mera-reader*)))))", "category": "dsl", "technique": "", "complexity": "intermediate", "quality_score": 0.86}