! (c)2010 Joe Groff bsd license USING: accessors arrays assocs hashtables hashtables.wrapped kernel parser sequences vocabs.loader ; IN: hashtables.identity TUPLE: identity-wrapper < wrapped-key ; C: identity-wrapper M: identity-wrapper equal? over identity-wrapper? [ [ underlying>> ] bi@ eq? ] [ 2drop f ] if ; inline M: identity-wrapper hashcode* nip underlying>> identity-hashcode ; inline TUPLE: identity-hashtable < wrapped-hashtable ; : ( n -- ihash ) identity-hashtable boa ; inline M: identity-hashtable wrap-key drop ; M: identity-hashtable clone underlying>> clone identity-hashtable boa ; inline : identity-associate ( value key -- hash ) 2 [ set-at ] keep ; inline : >identity-hashtable ( assoc -- ihashtable ) [ assoc-size ] keep assoc-union! ; SYNTAX: IH{ \ } [ >identity-hashtable ] parse-literal ; { "hashtables.identity" "prettyprint" } "hashtables.identity.prettyprint" require-when { "hashtables.identity" "mirrors" } "hashtables.identity.mirrors" require-when