Biassocs have special clone method

Daniel Ehrenberg 2009-08-18 12:48:09 -05:00
parent fc350768cb
commit 8467ee01b3
2 changed files with 15 additions and 2 deletions

View File

@ -1,4 +1,4 @@
USING: biassocs assocs namespaces tools.test ;
USING: biassocs assocs namespaces tools.test hashtables kernel ;
IN: biassocs.tests
<bihash> "h" set
@ -30,3 +30,13 @@ H{ { "a" "A" } { "b" "B" } } "a" set
[ "A" ] [ "a" "b" get at ] unit-test
[ "a" ] [ "A" "b" get value-at ] unit-test
[ ] [ H{ { 1 2 } } >biassoc "h" set ] unit-test
[ ] [ "h" get clone "g" set ] unit-test
[ ] [ 3 4 "g" get set-at ] unit-test
[ H{ { 1 2 } } ] [ "h" get >hashtable ] unit-test
[ H{ { 1 2 } { 4 3 } } ] [ "g" get >hashtable ] unit-test

View File

@ -43,4 +43,7 @@ M: biassoc new-assoc
INSTANCE: biassoc assoc
: >biassoc ( assoc -- biassoc )
T{ biassoc } assoc-clone-like ;
T{ biassoc } assoc-clone-like ;
M: biassoc clone
[ from>> ] [ to>> ] bi [ clone ] bi@ biassoc boa ;