diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2023-02-19 23:41:00 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2023-02-19 23:41:00 -0300 |
commit | ce4838b58104b589894081b6c5cbd52554cf87a7 (patch) | |
tree | dbefb70d1c00ade4a5cbff3db6bf6ef006e88fd3 /json.lisp | |
parent | a0586bd6fed38914b2112c5f834bd66140758e30 (diff) | |
download | json-ce4838b58104b589894081b6c5cbd52554cf87a7.tar.gz json-ce4838b58104b589894081b6c5cbd52554cf87a7.zip |
Add todo.txt
Diffstat (limited to 'json.lisp')
-rw-r--r-- | json.lisp | 10 |
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))) |