From 816f60a6e75beeaf0972de09a93bfbb51a194104 Mon Sep 17 00:00:00 2001 From: slava Date: Fri, 18 Aug 2006 03:50:59 +0000 Subject: [PATCH] Eliminate with-class [ with-classclass ( n -- class ) builtins get nth ; : predicate-word ( word -- predicate ) @@ -31,7 +32,7 @@ SYMBOL: builtins : superclass ( class -- super ) "superclass" word-prop ; -: members "members" word-prop ; +: members ( class -- seq ) "members" word-prop ; : (flatten-class) ( class -- ) dup members [ [ (flatten-class) ] each ] [ dup set ] ?if ; @@ -69,22 +70,8 @@ DEFER: (class<) { [ t ] [ union-class< ] } } cond ; -SYMBOL: classhash - ] map>hash nip ; - -: with-classhash ] keep + classhash ] unit-test +[ H{ } ] [ { } [ dup ] map>hash ] unit-test [ ] [ 1000 [ dup sq ] map>hash "testhash" set ] unit-test @@ -199,11 +199,6 @@ H{ } clone "cache-test" set [ { 1 3 } ] [ H{ { 2 2 } } { 1 2 3 } remove-all ] unit-test -[ H{ } ] [ { } hash-concat ] unit-test -[ H{ } ] [ { H{ } } hash-concat ] unit-test -[ H{ { 1 2 } } ] [ { H{ { 1 2 } } } hash-concat ] unit-test -[ H{ { 1 2 } { 3 4 } } ] [ { H{ { 1 2 } } H{ { 3 4 } } } hash-concat ] unit-test - ! Resource leak... H{ } "x" set 100 [ drop "x" get clear-hash ] each diff --git a/library/test/generic.factor b/library/test/generic.factor index 261874814f..755d9148f4 100644 --- a/library/test/generic.factor +++ b/library/test/generic.factor @@ -56,33 +56,28 @@ M: very-funny gooey sq ; [ 1/4 ] [ 1/2 gooey ] unit-test -: classfloat ] ] [ \ float \ integer math-upgrade ] unit-test [ number ] [ \ number \ float math-class-max ] unit-test [ float ] [ \ real \ float math-class-max ] unit-test + +TUPLE: forget-class-test ; +[ t ] [ forget-class-test tuple classstring + { "a" "b" } { "c" "d" } effect>string ] unit-test [ "( -- c d )" ] [ - { { } { "c" "d" } } effect>string + { } { "c" "d" } effect>string ] unit-test [ "( a b -- )" ] [ - { { "a" "b" } { } } effect>string + { "a" "b" } { } effect>string ] unit-test [ "( -- )" ] [ - { { } { } } effect>string + { } { } effect>string ] unit-test [ ] [ \ fixnum see ] unit-test diff --git a/library/test/redefine.factor b/library/test/redefine.factor index 6b9617a9a0..039ee30723 100644 --- a/library/test/redefine.factor +++ b/library/test/redefine.factor @@ -2,8 +2,8 @@ USING: compiler definitions generic hashtables inference math namespaces parser test words ; IN: temporary -DEFER: foo -DEFER: bar +DEFER: foo \ foo reset-generic +DEFER: bar \ bar reset-generic [ ] [ \ foo [ 1 2 ] define-compound ] unit-test [ { 0 2 } ] [ [ foo ] infer ] unit-test