(defun process-template-funs (template) "Takes in a TEMPLATE and converts all the key args within each plist into the associated functions ready to be called" (labels ((rec (list acc) (cond ((null list) nil) ((listp list) (if (and (listp (first list)) (keywordp (first (first list)))) (cons (compile-template-entry (first list)) (rec (rest list) acc)) (cons (rec (first list) acc) (rec (rest list) acc))))))) (if (eql (first template) 'quote) (rec (eval template) nil) (rec template nil)))) ;;examples inputs (defparameter *test-template7* `((:equal "year")(:type integer :or (96 97 98)) ((:or ("cookie" "country" "keyvals")) ,(repeat-pattern 3 '((:type string :maxlen 6 :minlen 2) (:type number :between (0 100)))) ,@(repeat-test 3 '(:type number :satisfies evenp))))) (defparameter *test-template7c* `'((:equal "year")(:type integer :or (96 97 98)) ((:or ("cookie" "country" "keyvals")) ,(repeat-pattern 3 '((:type string :maxlen 6 :minlen 2) (:type number :between (0 100)))) ,@(repeat-test 3 '(:type number :satisfies evenp))))) ;;7 gets correct output, 7c incorrect (when eval isn't present) (defun quoted-p (form) (and (listp form) (eql (car form) 'quote) (endp (cddr form)))) (defun process-template-funs (template) "Takes in a TEMPLATE and converts all the key args within each plist into the associated functions ready to be called" (print template) (labels ((rec (list acc) (cond ((null list) nil) ((listp list) (if (and (listp (first list)) (keywordp (first (first list)))) (cons (compile-template-entry (first list)) (rec (rest list) acc)) (cons (rec (first list) acc) (rec (rest list) acc))))))) (if (quoted-p template) (first (rec (rest template) nil)) (rec template nil))))