]> gitweb.factorcode.org Git - factor.git/commitdiff
fix object /\\ number
authorSlava Pestov <slava@factorcode.org>
Thu, 23 Dec 2004 23:46:21 +0000 (23:46 +0000)
committerSlava Pestov <slava@factorcode.org>
Thu, 23 Dec 2004 23:46:21 +0000 (23:46 +0000)
library/generic/generic.factor
library/inference/words.factor
library/test/generic.factor
library/test/inference.factor

index bf6826765264db0ce3e16d447804cf94ae6d41f1..c4e376498dca0abb23e21ba8980e43d3935a0841 100644 (file)
@@ -162,6 +162,9 @@ SYMBOL: object
 : type-union ( list list -- list )
     append prune [ > ] sort ;
 
+: type-intersection ( list list -- list )
+    intersection [ > ] sort ;
+
 : class-or ( class class -- class )
     #! Return a class that both classes are subclasses of.
     swap builtin-supertypes
@@ -173,7 +176,7 @@ SYMBOL: object
     #! error if this is impossible.
     over builtin-supertypes
     over builtin-supertypes
-    intersection dup [
+    type-intersection dup [
         nip nip classes get hash [ object ] unless*
     ] [
         drop [
@@ -187,4 +190,4 @@ SYMBOL: object
     dup builtin-supertypes [ > ] sort
     classes get set-hash ;
 
-global [ <namespace> classes set ] bind
+global [ classes get [ <namespace> classes set ] unless ] bind
index f5970a0c6c566d66f77ad9bb7f1d5a5c64eeb4e8..eef233f2111a9ccf4bf7a31d6ebb97667cfa5725 100644 (file)
@@ -37,7 +37,6 @@ USE: strings
 USE: vectors
 USE: words
 USE: hashtables
-USE: prettyprint
 
 : with-dataflow ( param op [ in | out ] quot -- )
     #! Take input parameters, execute quotation, take output
index d84b8659fe8f8e80bd2caafc9d55ad93145dc9ef..dc119ab0995ed50d1608a7b2546a3909f72c7076 100644 (file)
@@ -136,3 +136,5 @@ M: very-funny gooey sq ;
 [ integer ] [ fixnum bignum class-or ] unit-test
 [ integer ] [ fixnum integer class-or ] unit-test
 [ rational ] [ ratio integer class-or ] unit-test
+[ number ] [ number object class-and ] unit-test
+[ number ] [ object number class-and ] unit-test
index 027ead53423291fa226c2e8e3cbe85dcfa3c36cc..29bb6eb0b1ed007ce7abb4005a78ce2e336299cd 100644 (file)
@@ -203,3 +203,4 @@ SYMBOL: sym-test
 [ [ [ cons ] [ cons ] ] ] [ [ uncons cons ] infer ] unit-test
 [ [ [ object ] [ object ] ] ] [ [ dup [ car ] when ] infer ] unit-test
 [ [ [ vector ] [ vector ] ] ] [ [ vector-clone ] infer ] unit-test
+[ [ [ number ] [ number ] ] ] [ [ dup + ] infer ] unit-test