From: David Vázquez Date: Sun, 16 Feb 2014 19:36:11 +0000 (+0100) Subject: Merge branch 'hashtables' X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=85f0d5790e87525e7bbde14ad21935ab683a328f;hp=630200c35426d484b124fa473a69c40da33b1061;p=jscl.git Merge branch 'hashtables' --- diff --git a/src/compiler/compiler.lisp b/src/compiler/compiler.lisp index 644ac6a..60860b3 100644 --- a/src/compiler/compiler.lisp +++ b/src/compiler/compiler.lisp @@ -1267,6 +1267,10 @@ (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) diff --git a/src/hash-table.lisp b/src/hash-table.lisp index 2488d1b..0641ca8 100644 --- a/src/hash-table.lisp +++ b/src/hash-table.lisp @@ -99,3 +99,10 @@ ,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))))