]> gitweb.factorcode.org Git - factor.git/commitdiff
hashtables.identity: support assoc-like
authorJoe Groff <arcata@gmail.com>
Wed, 2 Nov 2011 02:38:42 +0000 (19:38 -0700)
committerJoe Groff <arcata@gmail.com>
Wed, 2 Nov 2011 20:23:17 +0000 (13:23 -0700)
basis/hashtables/identity/identity.factor

index 88f4de5c92d8c87c6dc2ce50563d52a887634c6e..0741a53bda199585dbc24ba80fb39e0395ae6411 100644 (file)
@@ -31,6 +31,9 @@ M: identity-hashtable clone
 : >identity-hashtable ( assoc -- ihashtable )\r
     [ assoc-size <identity-hashtable> ] keep assoc-union! ;\r
 \r
+M: identity-hashtable assoc-like\r
+    drop dup identity-hashtable? [ >identity-hashtable ] unless ; inline\r
+\r
 SYNTAX: IH{ \ } [ >identity-hashtable ] parse-literal ;\r
 \r
 { "hashtables.identity" "prettyprint" } "hashtables.identity.prettyprint" require-when\r