From ef42aa8681ac2cab218c9911afc894e5c0debb91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Sat, 6 Aug 2022 02:37:36 -0300 Subject: Eval downcase-name at compile time --- shtml.lisp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'shtml.lisp') diff --git a/shtml.lisp b/shtml.lisp index 8f5d7f0..ac72d2c 100644 --- a/shtml.lisp +++ b/shtml.lisp @@ -4,8 +4,10 @@ (loop :for (i . j) :in lst :when j :append (list i j))) -(defun downcase-name (s) - (string-downcase (symbol-name s))) +(eval-when + (:compile-toplevel) + (defun downcase-name (s) + (string-downcase (symbol-name s)))) (defun separate-keys (lst) (let (keys body) @@ -31,11 +33,11 @@ (let ((body (gensym)) (parsed-args (separate-keys ,args))) `((lambda (,body &key ,@',attrs) - (format nil "<~a~{ ~a=~s~}>~{~a~^ ~}" - ,,tag-name - (trim-flatten-assoc ,',attrs-and-values) - ,body - ,,tag-name)) ,@parsed-args))) + (format nil "<~a~{ ~a=~s~}>~{~a~^ ~}" + ,,tag-name + (trim-flatten-assoc ,',attrs-and-values) + ,body + ,,tag-name)) ,@parsed-args))) `(defun ,tag (&key ,@attrs) (format nil "<~a ~{~a=~s~^ ~}>" ,tag-name -- cgit v1.2.3