Add `remhash' function
authorDavid Vázquez <davazp@gmail.com>
Sun, 16 Feb 2014 19:36:07 +0000 (20:36 +0100)
committerDavid Vázquez <davazp@gmail.com>
Sun, 16 Feb 2014 19:36:07 +0000 (20:36 +0100)
src/compiler/compiler.lisp
src/hash-table.lisp

index 644ac6a..60860b3 100644 (file)
 (define-builtin in (key object)
   `(bool (in (call |xstring| ,key) ,object)))
 
+(define-builtin delete-property (key object)
+  `(selfcall
+    (delete (property ,object (call |xstring| ,key)))))
+
 (define-builtin map-for-in (function object)
   `(selfcall
     (var (f ,function)
index e598150..8125e9e 100644 (file)
                ,g!new-value)              
             `(gethash ,g!new-value ,g!key ,g!hash-table)    ; accessing form
             )))
+
+
+(defun remhash (key hash-table)
+  (let ((obj (caddr hash-table))
+        (hash (funcall (cadr hash-table) key)))
+    (prog1 (in hash obj)
+      (delete-property hash obj))))