]> gitweb.factorcode.org Git - factor.git/commitdiff
Start Factor 0.69
authorSlava Pestov <slava@factorcode.org>
Wed, 10 Nov 2004 03:47:01 +0000 (03:47 +0000)
committerSlava Pestov <slava@factorcode.org>
Wed, 10 Nov 2004 03:47:01 +0000 (03:47 +0000)
doc/tutorial/numbers-game.factor [deleted file]
doc/tutorial/timesheet.factor [deleted file]
examples/numbers-game.factor [new file with mode: 0644]
examples/timesheet.factor [new file with mode: 0644]
factor/FactorInterpreter.java
factor/jedit/FactorPlugin.props
library/test/test.factor
library/vector-combinators.factor

diff --git a/doc/tutorial/numbers-game.factor b/doc/tutorial/numbers-game.factor
deleted file mode 100644 (file)
index 4d99271..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-! Numbers game example
-
-IN: numbers-game
-USE: combinators
-USE: kernel
-USE: math
-USE: parser
-USE: random
-USE: stdio
-USE: stack
-
-: read-number ( -- n ) read parse-number ;
-
-: guess-banner
-    "I'm thinking of a number between 0 and 100." print ;
-: guess-prompt "Enter your guess: " write ;
-: too-high "Too high" print ;
-: too-low "Too low" print ;
-: correct "Correct - you win!" print ;
-
-: inexact-guess ( actual guess -- )
-     < [ too-high ] [ too-low ] ifte ;
-
-: judge-guess ( actual guess -- ? )
-    2dup = [
-        2drop correct f
-    ] [
-        inexact-guess t
-    ] ifte ;
-
-: number-to-guess ( -- n ) 0 100 random-int ;
-
-: numbers-game-loop ( actual -- )
-    dup guess-prompt read-number judge-guess [
-        numbers-game-loop
-    ] [
-        drop
-    ] ifte ;
-
-: numbers-game number-to-guess numbers-game-loop ;
diff --git a/doc/tutorial/timesheet.factor b/doc/tutorial/timesheet.factor
deleted file mode 100644 (file)
index e3803a7..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-! Contractor timesheet example
-
-IN: timesheet
-USE: combinators
-USE: errors
-USE: format
-USE: kernel
-USE: lists
-USE: math
-USE: parser
-USE: stack
-USE: stdio
-USE: strings
-USE: unparser
-USE: vectors
-
-! Adding a new entry to the time sheet.
-
-: measure-duration ( -- duration )
-    millis
-    read drop
-    millis swap - 1000 /i 60 /i ;
-
-: add-entry-prompt ( -- duration description )
-    "Start work on the task now. Press ENTER when done." print
-    measure-duration
-    "Please enter a description:" print
-    read ;
-
-: add-entry ( timesheet -- )
-    add-entry-prompt cons swap vector-push ;
-
-! Printing the timesheet.
-
-: hh ( duration -- str ) 60 /i ;
-: mm ( duration -- str ) 60 mod unparse 2 digits ;
-: hh:mm ( millis -- str ) <% dup hh % ":" % mm % %> ;
-
-: print-entry ( duration description -- )
-    dup write
-    60 swap pad-string write
-    hh:mm print ;
-
-: print-timesheet ( timesheet -- )
-    "TIMESHEET:" print
-    [ uncons print-entry ] vector-each ;
-
-! Displaying a menu
-
-: print-menu ( menu -- )
-    terpri [ cdr car print ] each terpri
-    "Enter a letter between ( ) to execute that action." print ;
-
-: menu-prompt ( menu -- )
-    read swap assoc dup [
-        cdr call
-    ] [
-        "Invalid input: " swap unparse cat2 throw
-    ] ifte ;
-
-: menu ( menu -- )
-    dup print-menu menu-prompt ;
-
-! Main menu
-
-: main-menu ( timesheet -- )
-    [
-        [ "e" "(E)xit" drop ]
-        [ "a" "(A)dd entry" dup add-entry main-menu ]
-        [ "p" "(P)rint timesheet" dup print-timesheet main-menu ]
-    ] menu ;
-
-: timesheet-app ( -- )
-    10 <vector> main-menu ;
diff --git a/examples/numbers-game.factor b/examples/numbers-game.factor
new file mode 100644 (file)
index 0000000..4d99271
--- /dev/null
@@ -0,0 +1,40 @@
+! Numbers game example
+
+IN: numbers-game
+USE: combinators
+USE: kernel
+USE: math
+USE: parser
+USE: random
+USE: stdio
+USE: stack
+
+: read-number ( -- n ) read parse-number ;
+
+: guess-banner
+    "I'm thinking of a number between 0 and 100." print ;
+: guess-prompt "Enter your guess: " write ;
+: too-high "Too high" print ;
+: too-low "Too low" print ;
+: correct "Correct - you win!" print ;
+
+: inexact-guess ( actual guess -- )
+     < [ too-high ] [ too-low ] ifte ;
+
+: judge-guess ( actual guess -- ? )
+    2dup = [
+        2drop correct f
+    ] [
+        inexact-guess t
+    ] ifte ;
+
+: number-to-guess ( -- n ) 0 100 random-int ;
+
+: numbers-game-loop ( actual -- )
+    dup guess-prompt read-number judge-guess [
+        numbers-game-loop
+    ] [
+        drop
+    ] ifte ;
+
+: numbers-game number-to-guess numbers-game-loop ;
diff --git a/examples/timesheet.factor b/examples/timesheet.factor
new file mode 100644 (file)
index 0000000..e3803a7
--- /dev/null
@@ -0,0 +1,74 @@
+! Contractor timesheet example
+
+IN: timesheet
+USE: combinators
+USE: errors
+USE: format
+USE: kernel
+USE: lists
+USE: math
+USE: parser
+USE: stack
+USE: stdio
+USE: strings
+USE: unparser
+USE: vectors
+
+! Adding a new entry to the time sheet.
+
+: measure-duration ( -- duration )
+    millis
+    read drop
+    millis swap - 1000 /i 60 /i ;
+
+: add-entry-prompt ( -- duration description )
+    "Start work on the task now. Press ENTER when done." print
+    measure-duration
+    "Please enter a description:" print
+    read ;
+
+: add-entry ( timesheet -- )
+    add-entry-prompt cons swap vector-push ;
+
+! Printing the timesheet.
+
+: hh ( duration -- str ) 60 /i ;
+: mm ( duration -- str ) 60 mod unparse 2 digits ;
+: hh:mm ( millis -- str ) <% dup hh % ":" % mm % %> ;
+
+: print-entry ( duration description -- )
+    dup write
+    60 swap pad-string write
+    hh:mm print ;
+
+: print-timesheet ( timesheet -- )
+    "TIMESHEET:" print
+    [ uncons print-entry ] vector-each ;
+
+! Displaying a menu
+
+: print-menu ( menu -- )
+    terpri [ cdr car print ] each terpri
+    "Enter a letter between ( ) to execute that action." print ;
+
+: menu-prompt ( menu -- )
+    read swap assoc dup [
+        cdr call
+    ] [
+        "Invalid input: " swap unparse cat2 throw
+    ] ifte ;
+
+: menu ( menu -- )
+    dup print-menu menu-prompt ;
+
+! Main menu
+
+: main-menu ( timesheet -- )
+    [
+        [ "e" "(E)xit" drop ]
+        [ "a" "(A)dd entry" dup add-entry main-menu ]
+        [ "p" "(P)rint timesheet" dup print-timesheet main-menu ]
+    ] menu ;
+
+: timesheet-app ( -- )
+    10 <vector> main-menu ;
index 2e5e477f245bd07d323c55a2cfdd83611772d6bc..5afab63685abcd0894ca7a1707cc2a0171ef6deb 100644 (file)
@@ -35,7 +35,7 @@ import java.io.*;
 
 public class FactorInterpreter implements FactorObject, Runnable
 {
-       public static final String VERSION = "0.68";
+       public static final String VERSION = "0.69";
 
        public static final Cons DEFAULT_USE = new Cons("builtins",
                new Cons("syntax",new Cons("scratchpad",null)));
index a9143db2aa4f1ba2a02bb30e61c18d3d0dd3993c..1a276f1cdc9cb3fb803f7d6dcd338d1bc3591e66 100644 (file)
@@ -3,7 +3,7 @@
 plugin.factor.jedit.FactorPlugin.activate=startup
 
 plugin.factor.jedit.FactorPlugin.name=Factor
-plugin.factor.jedit.FactorPlugin.version=0.68
+plugin.factor.jedit.FactorPlugin.version=0.69
 plugin.factor.jedit.FactorPlugin.author=Slava Pestov
 plugin.factor.jedit.FactorPlugin.docs=/doc/jedit/index.html
 
index e6225442ab783787542636787930970df170cfea..deb91a7940c205f33472d03525e91778496bd8b8 100644 (file)
@@ -119,7 +119,7 @@ USE: unparser
 
         cpu "x86" = [
             [
-                "hsv" test
+                "hsv"
                 "x86-compiler/simple"
                 "x86-compiler/stack"
                 "x86-compiler/ifte"
index 76a13bc0e4bd2c9ecbb3957b58f72e72c2b2b4f4..4878f57d87d9ad5b1b80751ba04488a251d16052 100644 (file)
@@ -72,7 +72,7 @@ USE: stack
     #! first two in a pair.
     over vector-length [
         pick pick 2vector-nth cons
-    ] vector-collect nip nip ;
+    ] vector-project nip nip ;
 
 : vector-2map ( v1 v2 quot -- v )
     #! Apply a quotation with stack effect ( obj obj -- obj ) to