;;;macro (defmacro send-with-json-contents ((name uri) normal-func-args) (let ((x (gensym)) (y (gensym))) `(defun ,name ,normal-func-args (let ((,x (defun-args-to-strings ',normal-func-args)) (,y (extract-passed-var-no-nested ,'normal-func-args '&key))) (send ,uri (cl-json:encode-json-to-string (list-to-alist (join-two-lists ,x ,y)))))))) ;;;expansion CLDAPI> (macroexpand-1 '(send-with-json-contents (modify-2 (comp-str "/channels/" channel-id)) (channel-id &key name position topic nsfw rate-limit-per-user bitrate user-limit permission-overwrites parent-id))) (DEFUN MODIFY-2 (CHANNEL-ID &KEY NAME POSITION TOPIC NSFW RATE-LIMIT-PER-USER BITRATE USER-LIMIT PERMISSION-OVERWRITES PARENT-ID) (LET ((#:G813 (DEFUN-ARGS-TO-STRINGS '(CHANNEL-ID &KEY NAME POSITION TOPIC NSFW RATE-LIMIT-PER-USER BITRATE USER-LIMIT PERMISSION-OVERWRITES PARENT-ID))) (#:G814 (EXTRACT-PASSED-VAR-NO-NESTED NORMAL-FUNC-ARGS '&KEY))) (SEND (COMP-STR "/channels/" CHANNEL-ID) (JSON:ENCODE-JSON-TO-STRING (LIST-TO-ALIST (JOIN-TWO-LISTS #:G813 #:G814)))))) T