]> gitweb.factorcode.org Git - factor.git/commitdiff
Minor fixes
authorslava <slava@factorcode.org>
Wed, 3 May 2006 00:26:48 +0000 (00:26 +0000)
committerslava <slava@factorcode.org>
Wed, 3 May 2006 00:26:48 +0000 (00:26 +0000)
doc/handbook/collections.facts
examples/mandel.factor
library/collections/namespaces.facts
library/compiler/generator/xt.factor
library/compiler/optimizer/inline-methods.factor
library/compiler/optimizer/optimizer.factor
library/continuations.facts
library/generic/math-combination.factor
library/generic/math-combination.facts
library/math/math.factor
library/tools/annotations.factor

index bb35ca060a7bb43f6daf7e12d486f7d23298d799..ac5991e9627912ccccf0f9826970e3757482cb95 100644 (file)
@@ -139,7 +139,6 @@ ARTICLE: "namespaces-make" "Constructing sequences"
 
 ARTICLE: "namespaces-internals" "Namespace implementation details"
 "The namestack holds namespaces."
-{ $subsection namestack* }
 { $subsection namestack }
 { $subsection set-namestack }
 "A pair of words push and pop namespaces on the namestack."
index c50491867be57654865954b9f5ef04eb62b13942..c738ec0f506c7f0fc6854d6e0999980fc0937196 100644 (file)
@@ -70,7 +70,7 @@ strings test ;
     ] map-with ;
 
 : iter ( c z nb-iter -- x )
-    over absq 4.0 >= over 0 = or
+    over absq 4.0 >= over zero? or
     [ 2nip ] [ 1- >r sq dupd + r> iter ] if ; inline
 
 SYMBOL: cols
index cf476d92d9f20cc82daedaa46cbd056e6f0e8bbc..886f82ae2b6f3ff50d9771ac71410b09d837d2f7 100644 (file)
@@ -1,5 +1,5 @@
 IN: namespaces
-USING: help ;
+USING: help kernel-internals ;
 
 HELP: get "( variable -- value )"
 { $values { "variable" "a variable, by convention a symbol" } { "value" "the value, or " { $link f } } }
index b8baa0e5170e8ff6bd014be6532efef35bfce0ec..c2962af6b71d4ada4acd233eddadd8cb1506ff80 100644 (file)
@@ -2,8 +2,8 @@
 ! See http://factor.sf.net/license.txt for BSD license.
 IN: compiler
 USING: assembler errors generic hashtables kernel
-kernel-internals lists math namespaces prettyprint sequences
-strings vectors words ;
+kernel-internals lists math namespaces prettyprint queues
+sequences strings vectors words ;
 
 : <label> ( -- label )
     #! Make a label.
index de85a18be8d036e1aa6b336086df2e8d1e1b74fd..7e1383047cda71c020b4614a5fca318313df034d 100644 (file)
@@ -45,8 +45,7 @@ kernel-internals lists math namespaces sequences words ;
 : inlining-class ( #call -- class )
     #! If the generic dispatch can be eliminated, return the
     #! class of the method that will always be invoked here.
-    dup node-param swap dispatching-class
-    specific-method ;
+    dup node-param swap dispatching-class specific-method ;
 
 : will-inline-method ( node -- quot/t )
     #! t indicates failure
@@ -83,8 +82,8 @@ kernel-internals lists math namespaces sequences words ;
     #! t indicates failure
     {
         { [ 3dup math-both-known? ] [ math-method ] }
-        { [ 3dup drop specific-method ] [ left-partial-math ] }
-        { [ 3dup nip specific-method ] [ right-partial-math ] }
+        { [ 3dup drop specific-method ] [ left-partial-math ] }
+        { [ 3dup nip specific-method ] [ right-partial-math ] }
         { [ t ] [ 3drop t ] }
     } cond ;
 
@@ -93,7 +92,8 @@ kernel-internals lists math namespaces sequences words ;
     will-inline-math-method (inline-method) ;
 
 : inline-math-method? ( #call -- ? )
-    dup node-history empty? swap node-param 2generic? and ;
+    dup node-history [ 2generic? ] contains? not
+    swap node-param 2generic? and ;
 
 : inline-method ( #call -- node )
     {
@@ -110,7 +110,7 @@ kernel-internals lists math namespaces sequences words ;
 
 : optimize-predicate? ( #call -- ? )
     dup node-param "predicating" word-prop dup [
-        >r dup 0 node-class# r> comparable?
+        >r 0 node-class# r> comparable?
     ] [
         2drop f
     ] if ;
index 4affecae6dac523a1e8090b30348c17a195b5bd7..e8bdfec2a0f7d1b4e37315dc1b8bca2f229e6f3f 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2004, 2006 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 IN: optimizer
-USING: generic hashtables inference io kernel
-lists math namespaces sequences vectors ;
+USING: generic hashtables inference io kernel lists math
+namespaces sequences test vectors ;
 
 SYMBOL: optimizer-changed
 
index cd01fdccb596165d937261d0a569af41f641cbae..d19997dc7218bbd90c46a2b486a117d6310f6ab6 100644 (file)
@@ -1,4 +1,4 @@
-USING: errors help kernel ;
+USING: errors help kernel kernel-internals ;
 
 HELP: catchstack* "( -- catchstack )"
 { $values { "catchstack" "a vector" } }
index 8f2a0a05a8eb438e246f242be51ec14a67768151..a35b5754f0ef385f290b8d7aba8fcf94cde60266 100644 (file)
@@ -8,9 +8,12 @@ lists math namespaces sequences words ;
 
 : first/last ( seq -- pair ) dup first swap peek 2array ;
 
+: math-class? ( object -- ? )
+    dup word? [ number bootstrap-word class< ] [ drop f ] if ;
+
 : math-class-compare ( class class -- n )
     [
-        dup number class<
+        dup math-class?
         [ types first/last ] [ drop { 100 100 } ] if
     ] 2apply <=> ;
 
@@ -56,9 +59,6 @@ TUPLE: no-math-method left right generic ;
 : math-vtable ( picker quot -- quot )
     num-tags swap math-vtable* ; inline
 
-: math-class? ( object -- ? )
-    dup word? [ "math-priority" word-prop ] [ drop f ] if ;
-
 : math-combination ( word -- quot )
     \ over [
         dup math-class? [
index 58904ed6f9d076f29063c08d3aadf64ffdcab9d2..a783171fa2c6d2f2090782cfcb5f66fc984871b7 100644 (file)
@@ -1,14 +1,5 @@
 USING: generic help math ;
 
-HELP: math-priority "( class -- n )"
-{ $values { "class" "a class word" } { "n" "a non-negative integer" } }
-{ $description "Outputs the priority of a built-in number class. If class A has a lower priority than class B, then applying a binary math operation to an instance of A and B will upgrade the instance of A to B's type." }
-{ $notes "To simplify implementation of the math method combination, this word outputs 100 for non-numeric classes. Priorities of numeric classes must always be less than 100." } ;
-
-HELP: math-class< "( class1 class2 -- ? )"
-{ $values { "class1" "a class word" } { "class2" "a class word" } { "?" "a boolean" } }
-{ $description "Defines a total ordering on built-in number classes." } ;
-
 HELP: math-upgrade "( class1 class2 -- quot )"
 { $values { "class1" "a class word" } { "class2" "a class word" } { "quot" "a quotation with stack effect " { $snippet "( n n -- n n )" } } }
 { $description "Outputs a quotation for upgrading numberical types. It takes two numbers on the stack, an instance of " { $snippet "class1" } ", and an instance of " { $snippet "class2" } ", and converts the one with the lower priority to the higher priority type." }
index 7a8afbfe3234d09ab25e06f2e3caefcf97fb19e2..7812df3032db8ed77124ce89713688d2098da20c 100644 (file)
@@ -36,9 +36,9 @@ GENERIC: absq ( n -- |n|^2 ) foldable
 GENERIC: zero? ( x -- ? ) foldable
 M: object zero? drop f ;
 
-: sq dup * ; inline
-: neg 0 swap - ; inline
-: recip 1 swap / ; inline
+: sq dup * ; foldable
+: neg 0 swap - ; foldable
+: recip 1 swap / ; foldable
 : max ( x y -- z ) [ > ] 2keep ? ; foldable
 : min ( x y -- z ) [ < ] 2keep ? ; foldable
 : between? ( x min max -- ? ) pick >= >r >= r> and ; foldable
@@ -48,7 +48,7 @@ M: object zero? drop f ;
 : truncate ( x -- y ) dup 1 mod - ; foldable
 
 : floor ( x -- y )
-    dup 1 mod dup 0 =
+    dup 1 mod dup zero?
     [ drop ] [ dup 0 < [ - 1- ] [ - ] if ] if ; foldable
 
 : ceiling ( x -- y ) neg floor neg ; foldable
index 093ad0a71bbb40195c6d5d91c60dc26350c48039..b8109123d5393e979559457a8d4d73b54905262c 100644 (file)
@@ -27,9 +27,5 @@ sequences strings walker ;
         nip [ swap % dup [ walk ] curry , , \ if , ] [ ] make
     ] annotate ;
 
-: with-profile ( quot word -- )
-    millis >r >r call r> millis r> - swap global [ +@ ] bind ;
-    inline
-
 : profile ( word -- )
-    [ swap [ with-profile ] curry cons ] annotate ;
+    [ swap [ global [ inc ] bind call ] curry cons ] annotate ;