summaryrefslogtreecommitdiff
path: root/generate.lisp
diff options
context:
space:
mode:
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)))