summaryrefslogtreecommitdiff
path: root/json.lisp
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2023-02-19 23:41:00 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2023-02-19 23:41:00 -0300
commitce4838b58104b589894081b6c5cbd52554cf87a7 (patch)
treedbefb70d1c00ade4a5cbff3db6bf6ef006e88fd3 /json.lisp
parenta0586bd6fed38914b2112c5f834bd66140758e30 (diff)
downloadjson-ce4838b58104b589894081b6c5cbd52554cf87a7.tar.gz
json-ce4838b58104b589894081b6c5cbd52554cf87a7.zip
Add todo.txt
Diffstat (limited to 'json.lisp')
-rw-r--r--json.lisp10
1 files changed, 10 insertions, 0 deletions
diff --git a/json.lisp b/json.lisp
new file mode 100644
index 0000000..8bb93e7
--- /dev/null
+++ b/json.lisp
@@ -0,0 +1,10 @@
+(in-package #:json)
+
+(defmacro obj (&rest fields)
+ (let ((o (gensym))
+ (f (gensym)))
+ (setf fields (mapcar (lambda (x) (cons 'list x)) fields))
+ `(let ((,o (make-hash-table :test #'equal :size ,(length fields))))
+ (dolist (,f ,(cons 'list fields))
+ (setf (gethash (car ,f) ,o) (cadr ,f)))
+ ,o)))