From fdeb8e5de32f21a4a016b99165d248a7d8c3abde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Fri, 3 Feb 2023 14:39:39 -0300 Subject: Change api and add object generation --- generate.lisp | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 generate.lisp (limited to 'generate.lisp') diff --git a/generate.lisp b/generate.lisp new file mode 100644 index 0000000..de213a4 --- /dev/null +++ b/generate.lisp @@ -0,0 +1,9 @@ +(in-package #:json) + +(defmacro obj (&rest fields) + (let ((o (gensym)) + (f (gensym))) + `(let ((,o (make-hash-table :test #'equal :size ,(length fields)))) + (dolist (,f ',fields) + (setf (gethash (car ,f) ,o) (cadr ,f))) + ,o))) -- cgit v1.2.3