summaryrefslogtreecommitdiff
path: root/generate.lisp
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2023-02-03 14:39:39 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2023-02-03 14:39:39 -0300
commitfdeb8e5de32f21a4a016b99165d248a7d8c3abde (patch)
treea98a034636d7188dfd0b8c3acde2ff69dfdc5af9 /generate.lisp
parente858144ddf1e50b3a390d33961945a9063d746f0 (diff)
downloadjson-fdeb8e5de32f21a4a016b99165d248a7d8c3abde.tar.gz
json-fdeb8e5de32f21a4a016b99165d248a7d8c3abde.zip
Change api and add object generation
Diffstat (limited to 'generate.lisp')
-rw-r--r--generate.lisp9
1 files changed, 9 insertions, 0 deletions
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)))