]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 20 Apr 2008 17:22:02 +0000 (12:22 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 20 Apr 2008 17:22:02 +0000 (12:22 -0500)
67 files changed:
core/bit-vectors/bit-vectors-docs.factor [deleted file]
core/bit-vectors/bit-vectors-tests.factor [deleted file]
core/bit-vectors/bit-vectors.factor [deleted file]
core/bit-vectors/summary.txt [deleted file]
core/bit-vectors/tags.txt [deleted file]
core/bootstrap/primitives.factor
core/bootstrap/syntax.factor
core/byte-vectors/byte-vectors-docs.factor [deleted file]
core/byte-vectors/byte-vectors-tests.factor [deleted file]
core/byte-vectors/byte-vectors.factor [deleted file]
core/byte-vectors/summary.txt [deleted file]
core/byte-vectors/tags.txt [deleted file]
core/compiler/tests/simple.factor
core/cpu/ppc/allot/allot.factor
core/cpu/x86/allot/allot.factor
core/float-vectors/float-vectors-docs.factor [deleted file]
core/float-vectors/float-vectors-tests.factor [deleted file]
core/float-vectors/float-vectors.factor [deleted file]
core/float-vectors/summary.txt [deleted file]
core/float-vectors/tags.txt [deleted file]
core/generator/generator.factor
core/inference/class/class.factor
core/optimizer/backend/backend.factor
core/optimizer/optimizer-tests.factor
core/prettyprint/backend/backend.factor
core/sequences/sequences-docs.factor
core/sequences/sequences-tests.factor
core/sequences/sequences.factor
core/syntax/syntax-docs.factor
core/syntax/syntax.factor
extra/benchmark/dispatch2/dispatch2.factor
extra/benchmark/dispatch3/dispatch3.factor
extra/benchmark/spectral-norm/spectral-norm.factor
extra/bit-vectors/bit-vectors-docs.factor [new file with mode: 0755]
extra/bit-vectors/bit-vectors-tests.factor [new file with mode: 0755]
extra/bit-vectors/bit-vectors.factor [new file with mode: 0755]
extra/bit-vectors/summary.txt [new file with mode: 0644]
extra/bit-vectors/tags.txt [new file with mode: 0644]
extra/byte-vectors/byte-vectors-docs.factor [new file with mode: 0755]
extra/byte-vectors/byte-vectors-tests.factor [new file with mode: 0755]
extra/byte-vectors/byte-vectors.factor [new file with mode: 0755]
extra/byte-vectors/summary.txt [new file with mode: 0644]
extra/byte-vectors/tags.txt [new file with mode: 0644]
extra/columns/authors.txt [new file with mode: 0644]
extra/columns/columns-docs.factor [new file with mode: 0644]
extra/columns/columns-tests.factor [new file with mode: 0644]
extra/columns/columns.factor [new file with mode: 0644]
extra/columns/summary.txt [new file with mode: 0644]
extra/columns/tags.txt [new file with mode: 0644]
extra/float-vectors/float-vectors-docs.factor [new file with mode: 0755]
extra/float-vectors/float-vectors-tests.factor [new file with mode: 0755]
extra/float-vectors/float-vectors.factor [new file with mode: 0755]
extra/float-vectors/summary.txt [new file with mode: 0644]
extra/float-vectors/tags.txt [new file with mode: 0644]
extra/help/handbook/handbook.factor
extra/help/help.factor
extra/math/fft/fft.factor
extra/math/haar/haar.factor
extra/sudoku/sudoku.factor
extra/tools/deploy/deploy.factor
extra/tools/deploy/macosx/macosx.factor
extra/tools/deploy/unix/unix.factor
extra/tools/deploy/windows/windows.factor
extra/ui/commands/commands.factor
extra/ui/gadgets/grids/grids.factor
extra/ui/gestures/gestures.factor
extra/windows/shell32/shell32.factor

diff --git a/core/bit-vectors/bit-vectors-docs.factor b/core/bit-vectors/bit-vectors-docs.factor
deleted file mode 100755 (executable)
index f2f5c4d..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-USING: arrays bit-arrays help.markup help.syntax kernel\r
-bit-vectors.private combinators ;\r
-IN: bit-vectors\r
-\r
-ARTICLE: "bit-vectors" "Bit vectors"\r
-"A bit vector is a resizable mutable sequence of bits. The literal syntax is covered in " { $link "syntax-bit-vectors" } ". Bit vector words are found in the " { $vocab-link "bit-vectors" } " vocabulary."\r
-$nl\r
-"Bit vectors form a class:"\r
-{ $subsection bit-vector }\r
-{ $subsection bit-vector? }\r
-"Creating bit vectors:"\r
-{ $subsection >bit-vector }\r
-{ $subsection <bit-vector> }\r
-"If you don't care about initial capacity, a more elegant way to create a new bit vector is to write:"\r
-{ $code "?V{ } clone" } ;\r
-\r
-ABOUT: "bit-vectors"\r
-\r
-HELP: bit-vector\r
-{ $description "The class of resizable bit vectors. See " { $link "syntax-bit-vectors" } " for syntax and " { $link "bit-vectors" } " for general information." } ;\r
-\r
-HELP: <bit-vector>\r
-{ $values { "n" "a positive integer specifying initial capacity" } { "bit-vector" bit-vector } }\r
-{ $description "Creates a new bit vector that can hold " { $snippet "n" } " bits before resizing." } ;\r
-\r
-HELP: >bit-vector\r
-{ $values { "seq" "a sequence" } { "bit-vector" bit-vector } }\r
-{ $description "Outputs a freshly-allocated bit vector with the same elements as a given sequence." } ;\r
-\r
-HELP: bit-array>vector\r
-{ $values { "bit-array" "an array" } { "length" "a non-negative integer" } { "bit-vector" bit-vector } }\r
-{ $description "Creates a new bit vector using the array for underlying storage with the specified initial length." }\r
-{ $warning "This word is in the " { $vocab-link "bit-vectors.private" } " vocabulary because it does not perform type or bounds checks. User code should call " { $link >bit-vector } " instead." } ;\r
diff --git a/core/bit-vectors/bit-vectors-tests.factor b/core/bit-vectors/bit-vectors-tests.factor
deleted file mode 100755 (executable)
index dff9a8d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-IN: bit-vectors.tests\r
-USING: tools.test bit-vectors vectors sequences kernel math ;\r
-\r
-[ 0 ] [ 123 <bit-vector> length ] unit-test\r
-\r
-: do-it\r
-    1234 swap [ >r even? r> push ] curry each ;\r
-\r
-[ t ] [\r
-    3 <bit-vector> dup do-it\r
-    3 <vector> dup do-it sequence=\r
-] unit-test\r
-\r
-[ t ] [ ?V{ } bit-vector? ] unit-test\r
diff --git a/core/bit-vectors/bit-vectors.factor b/core/bit-vectors/bit-vectors.factor
deleted file mode 100755 (executable)
index db941ac..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-! Copyright (C) 2008 Slava Pestov.\r
-! See http://factorcode.org/license.txt for BSD license.\r
-USING: arrays kernel kernel.private math sequences\r
-sequences.private growable bit-arrays ;\r
-IN: bit-vectors\r
-\r
-<PRIVATE\r
-\r
-: bit-array>vector ( bit-array length -- bit-vector )\r
-    bit-vector boa ; inline\r
-\r
-PRIVATE>\r
-\r
-: <bit-vector> ( n -- bit-vector )\r
-    <bit-array> 0 bit-array>vector ; inline\r
-\r
-: >bit-vector ( seq -- bit-vector ) ?V{ } clone-like ;\r
-\r
-M: bit-vector like\r
-    drop dup bit-vector? [\r
-        dup bit-array?\r
-        [ dup length bit-array>vector ] [ >bit-vector ] if\r
-    ] unless ;\r
-\r
-M: bit-vector new-sequence\r
-    drop [ <bit-array> ] keep >fixnum bit-array>vector ;\r
-\r
-M: bit-vector equal?\r
-    over bit-vector? [ sequence= ] [ 2drop f ] if ;\r
-\r
-M: bit-array new-resizable drop <bit-vector> ;\r
-\r
-INSTANCE: bit-vector growable\r
diff --git a/core/bit-vectors/summary.txt b/core/bit-vectors/summary.txt
deleted file mode 100644 (file)
index 76a7d0f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Growable bit arrays
diff --git a/core/bit-vectors/tags.txt b/core/bit-vectors/tags.txt
deleted file mode 100644 (file)
index 42d711b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-collections
index f1e41ac2b60e7a12d1563ce8487a2b4f7021ac05..061866fe3e30a104c3cd0f73d818387c26ad1cca 100755 (executable)
@@ -58,16 +58,13 @@ num-types get f <array> builtins set
     "alien.accessors"
     "arrays"
     "bit-arrays"
-    "bit-vectors"
     "byte-arrays"
-    "byte-vectors"
     "classes.private"
     "classes.tuple"
     "classes.tuple.private"
     "compiler.units"
     "continuations.private"
     "float-arrays"
-    "float-vectors"
     "generator"
     "growable"
     "hashtables"
@@ -455,54 +452,6 @@ tuple
     }
 } define-tuple-class
 
-"byte-vector" "byte-vectors" create
-tuple
-{
-    {
-        { "byte-array" "byte-arrays" }
-        "underlying"
-        { "underlying" "growable" }
-        { "set-underlying" "growable" }
-    } {
-        { "array-capacity" "sequences.private" }
-        "fill"
-        { "length" "sequences" }
-        { "set-fill" "growable" }
-    }
-} define-tuple-class
-
-"bit-vector" "bit-vectors" create
-tuple
-{
-    {
-        { "bit-array" "bit-arrays" }
-        "underlying"
-        { "underlying" "growable" }
-        { "set-underlying" "growable" }
-    } {
-        { "array-capacity" "sequences.private" }
-        "fill"
-        { "length" "sequences" }
-        { "set-fill" "growable" }
-    }
-} define-tuple-class
-
-"float-vector" "float-vectors" create
-tuple
-{
-    {
-        { "float-array" "float-arrays" }
-        "underlying"
-        { "underlying" "growable" }
-        { "set-underlying" "growable" }
-    } {
-        { "array-capacity" "sequences.private" }
-        "fill"
-        { "length" "sequences" }
-        { "set-fill" "growable" }
-    }
-} define-tuple-class
-
 "curry" "kernel" create
 tuple
 {
index 4d5f31dc823cc6afad526093c8991dae75dac87a..4b748047492d013cbf37770f6e5888bd5d3367a0 100755 (executable)
@@ -14,16 +14,13 @@ IN: bootstrap.syntax
     ";"
     "<PRIVATE"
     "?{"
-    "?V{"
     "BIN:"
     "B{"
-    "BV{"
     "C:"
     "CHAR:"
     "DEFER:"
     "ERROR:"
     "F{"
-    "FV{"
     "FORGET:"
     "GENERIC#"
     "GENERIC:"
diff --git a/core/byte-vectors/byte-vectors-docs.factor b/core/byte-vectors/byte-vectors-docs.factor
deleted file mode 100755 (executable)
index 0f1054e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-USING: arrays byte-arrays help.markup help.syntax kernel\r
-byte-vectors.private combinators ;\r
-IN: byte-vectors\r
-\r
-ARTICLE: "byte-vectors" "Byte vectors"\r
-"A byte vector is a resizable mutable sequence of unsigned bytes. The literal syntax is covered in " { $link "syntax-byte-vectors" } ". Byte vector words are found in the " { $vocab-link "byte-vectors" } " vocabulary."\r
-$nl\r
-"Byte vectors form a class:"\r
-{ $subsection byte-vector }\r
-{ $subsection byte-vector? }\r
-"Creating byte vectors:"\r
-{ $subsection >byte-vector }\r
-{ $subsection <byte-vector> }\r
-"If you don't care about initial capacity, a more elegant way to create a new byte vector is to write:"\r
-{ $code "BV{ } clone" } ;\r
-\r
-ABOUT: "byte-vectors"\r
-\r
-HELP: byte-vector\r
-{ $description "The class of resizable byte vectors. See " { $link "syntax-byte-vectors" } " for syntax and " { $link "byte-vectors" } " for general information." } ;\r
-\r
-HELP: <byte-vector>\r
-{ $values { "n" "a positive integer specifying initial capacity" } { "byte-vector" byte-vector } }\r
-{ $description "Creates a new byte vector that can hold " { $snippet "n" } " bytes before resizing." } ;\r
-\r
-HELP: >byte-vector\r
-{ $values { "seq" "a sequence" } { "byte-vector" byte-vector } }\r
-{ $description "Outputs a freshly-allocated byte vector with the same elements as a given sequence." }\r
-{ $errors "Throws an error if the sequence contains elements other than integers." } ;\r
-\r
-HELP: byte-array>vector\r
-{ $values { "byte-array" "an array" } { "length" "a non-negative integer" } { "byte-vector" byte-vector } }\r
-{ $description "Creates a new byte vector using the array for underlying storage with the specified initial length." }\r
-{ $warning "This word is in the " { $vocab-link "byte-vectors.private" } " vocabulary because it does not perform type or bounds checks. User code should call " { $link >byte-vector } " instead." } ;\r
diff --git a/core/byte-vectors/byte-vectors-tests.factor b/core/byte-vectors/byte-vectors-tests.factor
deleted file mode 100755 (executable)
index d457d68..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-IN: byte-vectors.tests\r
-USING: tools.test byte-vectors vectors sequences kernel ;\r
-\r
-[ 0 ] [ 123 <byte-vector> length ] unit-test\r
-\r
-: do-it\r
-    123 [ over push ] each ;\r
-\r
-[ t ] [\r
-    3 <byte-vector> do-it\r
-    3 <vector> do-it sequence=\r
-] unit-test\r
-\r
-[ t ] [ BV{ } byte-vector? ] unit-test\r
diff --git a/core/byte-vectors/byte-vectors.factor b/core/byte-vectors/byte-vectors.factor
deleted file mode 100755 (executable)
index 206a23f..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-! Copyright (C) 2008 Slava Pestov.\r
-! See http://factorcode.org/license.txt for BSD license.\r
-USING: arrays kernel kernel.private math sequences\r
-sequences.private growable byte-arrays ;\r
-IN: byte-vectors\r
-\r
-<PRIVATE\r
-\r
-: byte-array>vector ( byte-array length -- byte-vector )\r
-    byte-vector boa ; inline\r
-\r
-PRIVATE>\r
-\r
-: <byte-vector> ( n -- byte-vector )\r
-    <byte-array> 0 byte-array>vector ; inline\r
-\r
-: >byte-vector ( seq -- byte-vector ) BV{ } clone-like ;\r
-\r
-M: byte-vector like\r
-    drop dup byte-vector? [\r
-        dup byte-array?\r
-        [ dup length byte-array>vector ] [ >byte-vector ] if\r
-    ] unless ;\r
-\r
-M: byte-vector new-sequence\r
-    drop [ <byte-array> ] keep >fixnum byte-array>vector ;\r
-\r
-M: byte-vector equal?\r
-    over byte-vector? [ sequence= ] [ 2drop f ] if ;\r
-\r
-M: byte-array new-resizable drop <byte-vector> ;\r
-\r
-INSTANCE: byte-vector growable\r
diff --git a/core/byte-vectors/summary.txt b/core/byte-vectors/summary.txt
deleted file mode 100644 (file)
index e914ebb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Growable byte arrays
diff --git a/core/byte-vectors/tags.txt b/core/byte-vectors/tags.txt
deleted file mode 100644 (file)
index 42d711b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-collections
index dce2ec562a2dd25cc60c31cd2c2b262e7f71d212..bc9c56864c32b722c2319eab00e905ab27ac1452 100755 (executable)
@@ -1,6 +1,6 @@
 USING: compiler.units tools.test kernel kernel.private
 sequences.private math.private math combinators strings
-alien arrays memory ;
+alien arrays memory vocabs parser ;
 IN: compiler.tests
 
 ! Test empty word
@@ -230,3 +230,11 @@ M: f single-combination-test-2 single-combination-test-4 ;
 
 ! Regression
 [ 100 ] [ [ 100 [ [ ] times ] keep ] compile-call ] unit-test
+
+! Regression
+10 [
+    [ "compiler.tests.foo" forget-vocab ] with-compilation-unit
+    [ t ] [
+        "USING: prettyprint words ; IN: compiler.tests.foo : (recursive) (  -- ) (recursive) (recursive) ; inline : recursive ( -- ) (recursive) ; \\ (recursive) compiled?" eval
+    ] unit-test
+] times
index 47dc6b1570afd0fbcf1449a68e25f0d9cc3875d5..49c77c65ed839aa1824cfc448558dd77d0792877 100755 (executable)
@@ -1,4 +1,4 @@
-! Copyright (C) 2006, 2007 Slava Pestov.
+! Copyright (C) 2006, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel cpu.ppc.architecture cpu.ppc.assembler
 kernel.private namespaces math sequences generic arrays
@@ -7,7 +7,7 @@ cpu.architecture alien ;
 IN: cpu.ppc.allot
 
 : load-zone-ptr ( reg -- )
-    "nursery" f pick %load-dlsym ;
+    >r "nursery" f r> %load-dlsym ;
 
 : %allot ( header size -- )
     #! Store a pointer to 'size' bytes allocated from the
@@ -30,8 +30,8 @@ M: ppc %gc
     12 load-zone-ptr
     11 12 cell LWZ ! nursery.here -> r11
     12 12 3 cells LWZ ! nursery.end -> r12
-    11 12 1024 ADDI ! add ALLOT_BUFFER_ZONE to here
-    0 11 12 CMPI ! is here >= end?
+    11 11 1024 ADDI ! add ALLOT_BUFFER_ZONE to here
+    11 0 12 CMP ! is here >= end?
     "end" get BLE
     0 frame-required
     %prepare-alien-invoke
index bfcede7ef7552a0007f8e76eeffdd9ffe746fd78..63870f94cddd359dd8c3834910dac989caf12b6e 100755 (executable)
@@ -29,7 +29,7 @@ IN: cpu.x86.allot
     allot-reg POP
     allot-reg cell [+] swap 8 align ADD ;
 
-M: x86.32 %gc ( -- )
+M: x86 %gc ( -- )
     "end" define-label
     temp-reg-1 load-zone-ptr
     temp-reg-2 temp-reg-1 cell [+] MOV
diff --git a/core/float-vectors/float-vectors-docs.factor b/core/float-vectors/float-vectors-docs.factor
deleted file mode 100755 (executable)
index ef0645a..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-USING: arrays float-arrays help.markup help.syntax kernel\r
-float-vectors.private combinators ;\r
-IN: float-vectors\r
-\r
-ARTICLE: "float-vectors" "Float vectors"\r
-"A float vector is a resizable mutable sequence of unsigned floats. The literal syntax is covered in " { $link "syntax-float-vectors" } ". Float vector words are found in the " { $vocab-link "float-vectors" } " vocabulary."\r
-$nl\r
-"Float vectors form a class:"\r
-{ $subsection float-vector }\r
-{ $subsection float-vector? }\r
-"Creating float vectors:"\r
-{ $subsection >float-vector }\r
-{ $subsection <float-vector> }\r
-"If you don't care about initial capacity, a more elegant way to create a new float vector is to write:"\r
-{ $code "FV{ } clone" } ;\r
-\r
-ABOUT: "float-vectors"\r
-\r
-HELP: float-vector\r
-{ $description "The class of resizable float vectors. See " { $link "syntax-float-vectors" } " for syntax and " { $link "float-vectors" } " for general information." } ;\r
-\r
-HELP: <float-vector>\r
-{ $values { "n" "a positive integer specifying initial capacity" } { "float-vector" float-vector } }\r
-{ $description "Creates a new float vector that can hold " { $snippet "n" } " floats before resizing." } ;\r
-\r
-HELP: >float-vector\r
-{ $values { "seq" "a sequence" } { "float-vector" float-vector } }\r
-{ $description "Outputs a freshly-allocated float vector with the same elements as a given sequence." }\r
-{ $errors "Throws an error if the sequence contains elements other than real numbers." } ;\r
-\r
-HELP: float-array>vector\r
-{ $values { "float-array" "an array" } { "length" "a non-negative integer" } { "float-vector" float-vector } }\r
-{ $description "Creates a new float vector using the array for underlying storage with the specified initial length." }\r
-{ $warning "This word is in the " { $vocab-link "float-vectors.private" } " vocabulary because it does not perform type or bounds checks. User code should call " { $link >float-vector } " instead." } ;\r
diff --git a/core/float-vectors/float-vectors-tests.factor b/core/float-vectors/float-vectors-tests.factor
deleted file mode 100755 (executable)
index 383dd4b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-IN: float-vectors.tests\r
-USING: tools.test float-vectors vectors sequences kernel ;\r
-\r
-[ 0 ] [ 123 <float-vector> length ] unit-test\r
-\r
-: do-it\r
-    12345 [ over push ] each ;\r
-\r
-[ t ] [\r
-    3 <float-vector> do-it\r
-    3 <vector> do-it sequence=\r
-] unit-test\r
-\r
-[ t ] [ FV{ } float-vector? ] unit-test\r
diff --git a/core/float-vectors/float-vectors.factor b/core/float-vectors/float-vectors.factor
deleted file mode 100755 (executable)
index 7f62f6f..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-! Copyright (C) 2008 Slava Pestov.\r
-! See http://factorcode.org/license.txt for BSD license.\r
-USING: arrays kernel kernel.private math sequences\r
-sequences.private growable float-arrays ;\r
-IN: float-vectors\r
-\r
-<PRIVATE\r
-\r
-: float-array>vector ( float-array length -- float-vector )\r
-    float-vector boa ; inline\r
-\r
-PRIVATE>\r
-\r
-: <float-vector> ( n -- float-vector )\r
-    0.0 <float-array> 0 float-array>vector ; inline\r
-\r
-: >float-vector ( seq -- float-vector ) FV{ } clone-like ;\r
-\r
-M: float-vector like\r
-    drop dup float-vector? [\r
-        dup float-array?\r
-        [ dup length float-array>vector ] [ >float-vector ] if\r
-    ] unless ;\r
-\r
-M: float-vector new-sequence\r
-    drop [ 0.0 <float-array> ] keep >fixnum float-array>vector ;\r
-\r
-M: float-vector equal?\r
-    over float-vector? [ sequence= ] [ 2drop f ] if ;\r
-\r
-M: float-array new-resizable drop <float-vector> ;\r
-\r
-INSTANCE: float-vector growable\r
diff --git a/core/float-vectors/summary.txt b/core/float-vectors/summary.txt
deleted file mode 100644 (file)
index c476f41..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Growable float arrays
diff --git a/core/float-vectors/tags.txt b/core/float-vectors/tags.txt
deleted file mode 100644 (file)
index 42d711b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-collections
index 4eb2c0fe4ef294ca30c2ca108ca54f356ee70460..390dc28d8e611936b60194dca52f3ce51ee82417 100755 (executable)
@@ -40,16 +40,16 @@ SYMBOL: current-label-start
     compiled-stack-traces?
     compiling-word get f ?
     1vector literal-table set
-    f compiling-word get compiled get set-at ;
+    f compiling-label get compiled get set-at ;
 
-: finish-compiling ( literals relocation labels code -- )
+: save-machine-code ( literals relocation labels code -- )
     4array compiling-label get compiled get set-at ;
 
 : with-generator ( node word label quot -- )
     [
         >r begin-compiling r>
         { } make fixup
-        finish-compiling
+        save-machine-code
     ] with-scope ; inline
 
 GENERIC: generate-node ( node -- next )
index c2629f107ffe7b87cfe0977cc41614fc545ba172..6d5b708f346cbe395d754b9f96447eb72907a953 100755 (executable)
@@ -328,15 +328,13 @@ M: #return infer-classes-around
     nested-labels get length 0 > [
         dup param>> nested-labels get peek param>> eq? [
             [ ] [ node-input-classes ] [ in-d>> [ value-class* ] map ] tri
-            classes= [
-                drop
-            ] [
+            classes= not [
                 fixed-point? off
                 [ in-d>> value-classes get extract-keys ] keep
                 set-node-classes
-            ] if
-        ] [ drop ] if
-    ] [ drop ] if ;
+            ] [ drop ] if
+        ] [ call-next-method ] if
+    ] [ call-next-method ] if ;
 
 M: object infer-classes-around
     {
@@ -369,5 +367,5 @@ M: object infer-classes-around
 : infer-classes/node ( node existing -- )
     #! Infer classes, using the existing node's class info as a
     #! starting point.
-    [ node-classes ] [ node-literals ] [ node-intervals ] tri
+    [ classes>> ] [ literals>> ] [ intervals>> ] tri
     infer-classes-with ;
index 3237f095bf3b3cbf5ae87be6c737a74d40ad741d..9630f9dc7047d22018655dd3677c0163a7e0a676 100755 (executable)
@@ -3,7 +3,7 @@
 USING: arrays generic assocs inference inference.class
 inference.dataflow inference.backend inference.state io kernel
 math namespaces sequences vectors words quotations hashtables
-combinators classes optimizer.def-use ;
+combinators classes optimizer.def-use accessors ;
 IN: optimizer.backend
 
 SYMBOL: class-substitutions
@@ -16,37 +16,32 @@ SYMBOL: optimizer-changed
 
 GENERIC: optimize-node* ( node -- node/t changed? )
 
-: ?union ( assoc/f assoc -- hash )
-    over [ assoc-union ] [ nip ] if ;
+: ?union ( assoc assoc/f -- assoc' )
+    dup assoc-empty? [ drop ] [ swap assoc-union ] if ;
 
-: add-node-literals ( assoc node -- )
-    over assoc-empty? [
-        2drop
-    ] [
-        [ node-literals ?union ] keep set-node-literals
-    ] if ;
+: add-node-literals ( node assoc -- )
+    [ ?union ] curry change-literals drop ;
 
-: add-node-classes ( assoc node -- )
-    over assoc-empty? [
-        2drop
-    ] [
-        [ node-classes ?union ] keep set-node-classes
-    ] if ;
+: add-node-classes ( node assoc -- )
+    [ ?union ] curry change-classes drop ;
 
-: substitute-values ( assoc node -- )
-    over assoc-empty? [
+: substitute-values ( node assoc -- )
+    dup assoc-empty? [
         2drop
     ] [
-        2dup node-in-d swap substitute-here
-        2dup node-in-r swap substitute-here
-        2dup node-out-d swap substitute-here
-        node-out-r swap substitute-here
+        {
+            [ >r  in-d>> r> substitute-here ]
+            [ >r  in-r>> r> substitute-here ]
+            [ >r out-d>> r> substitute-here ]
+            [ >r out-r>> r> substitute-here ]
+        } 2cleave
     ] if ;
 
 : perform-substitutions ( node -- )
-    class-substitutions get over add-node-classes
-    literal-substitutions get over add-node-literals
-    value-substitutions get swap substitute-values ;
+    [   class-substitutions get add-node-classes  ]
+    [ literal-substitutions get add-node-literals ]
+    [   value-substitutions get substitute-values ]
+    tri ;
 
 DEFER: optimize-nodes
 
@@ -90,18 +85,21 @@ M: node optimize-node* drop t f ;
     #! Not very efficient.
     dupd union* update ;
 
-: compute-value-substitutions ( #return/#values #call/#merge -- assoc )
-    node-out-d swap node-in-d 2array unify-lengths flip
+: compute-value-substitutions ( #call/#merge #return/#values -- assoc )
+    [ out-d>> ] [ in-d>> ] bi* 2array unify-lengths flip
     [ = not ] assoc-subset >hashtable ;
 
 : cleanup-inlining ( #return/#values -- newnode changed? )
-    dup node-successor dup [
-        class-substitutions get pick node-classes update
-        literal-substitutions get pick node-literals update
-        tuck compute-value-substitutions value-substitutions get swap update*
-        node-successor t
+    dup node-successor [
+        [ node-successor ] keep
+        {
+            [ nip classes>> class-substitutions get swap update ]
+            [ nip literals>> literal-substitutions get swap update ]
+            [ compute-value-substitutions value-substitutions get swap update* ]
+            [ drop node-successor ]
+        } 2cleave t
     ] [
-        2drop t f
+        drop t f
     ] if ;
 
 ! #return
index 63a63a2f92f8d26c7225fbd097f82688b89bb94f..14dcd62c61884f14b417f53994a907befaf42774 100755 (executable)
@@ -291,7 +291,6 @@ TUPLE: silly-tuple a b ;
 
 [ 1 2 3 ] [ lift-loop-tail-test-2 ] unit-test
 
-! Make sure we don't lose
 GENERIC: generic-inline-test ( x -- y )
 M: integer generic-inline-test ;
 
@@ -308,6 +307,7 @@ M: integer generic-inline-test ;
     generic-inline-test
     generic-inline-test ;
 
+! Inlining all of the above should only take two passes
 [ { t f } ] [
     \ generic-inline-test-1 word-def dataflow
     [ optimize-1 , optimize-1 , drop ] { } make
index c9019b029d70dd486cb077f79f38cb4b7fa38c00..c9933d5be2cf8b18d240d995d0623dac2c2a0fc7 100755 (executable)
@@ -1,11 +1,10 @@
 ! Copyright (C) 2003, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays byte-arrays byte-vectors bit-arrays bit-vectors
-generic hashtables io assocs kernel math namespaces sequences
-strings sbufs io.styles vectors words prettyprint.config
-prettyprint.sections quotations io io.files math.parser effects
-classes.tuple classes.tuple.private classes float-arrays
-float-vectors ;
+USING: arrays byte-arrays bit-arrays generic hashtables io
+assocs kernel math namespaces sequences strings sbufs io.styles
+vectors words prettyprint.config prettyprint.sections quotations
+io io.files math.parser effects classes.tuple
+classes.tuple.private classes float-arrays ;
 IN: prettyprint.backend
 
 GENERIC: pprint* ( obj -- )
@@ -140,11 +139,8 @@ M: curry pprint-delims drop \ [ \ ] ;
 M: compose pprint-delims drop \ [ \ ] ;
 M: array pprint-delims drop \ { \ } ;
 M: byte-array pprint-delims drop \ B{ \ } ;
-M: byte-vector pprint-delims drop \ BV{ \ } ;
 M: bit-array pprint-delims drop \ ?{ \ } ;
-M: bit-vector pprint-delims drop \ ?V{ \ } ;
 M: float-array pprint-delims drop \ F{ \ } ;
-M: float-vector pprint-delims drop \ FV{ \ } ;
 M: vector pprint-delims drop \ V{ \ } ;
 M: hashtable pprint-delims drop \ H{ \ } ;
 M: tuple pprint-delims drop \ T{ \ } ;
@@ -156,9 +152,6 @@ GENERIC: >pprint-sequence ( obj -- seq )
 M: object >pprint-sequence ;
 
 M: vector >pprint-sequence ;
-M: bit-vector >pprint-sequence ;
-M: byte-vector >pprint-sequence ;
-M: float-vector >pprint-sequence ;
 M: curry >pprint-sequence ;
 M: compose >pprint-sequence ;
 M: hashtable >pprint-sequence >alist ;
index bb3dc9337e84317e351273e7e6668c84e0d39d66..0dea0f43d96d7c632590888de34341c7f1ae06ca 100755 (executable)
@@ -76,10 +76,7 @@ ARTICLE: "sequences-reshape" "Reshaping sequences"
 { $subsection reversed }
 { $subsection <reversed> }
 "Transposing a matrix:"
-{ $subsection flip }
-"A " { $emphasis "column" } " presents a column of a matrix represented as a sequence of rows:"
-{ $subsection column }
-{ $subsection <column> } ;
+{ $subsection flip } ;
 
 ARTICLE: "sequences-appending" "Appending sequences"
 { $subsection append }
@@ -785,23 +782,6 @@ HELP: <slice>
 
 { <slice> subseq } related-words
 
-HELP: column
-{ $class-description "A virtual sequence which presents a fixed column of a matrix represented as a sequence of rows. New instances can be created by calling " { $link <column> } "." } ;
-
-HELP: <column> ( seq n -- column )
-{ $values { "seq" sequence } { "n" "a non-negative integer" } { "column" column } }
-{ $description "Outputs a new virtual sequence which presents a fixed column of a matrix represented as a sequence of rows." "The " { $snippet "i" } "th element of a column is the " { $snippet "n" } "th element of the " { $snippet "i" } "th element of" { $snippet "seq" } ". Every element of " { $snippet "seq" } " must be a sequence, and all sequences must have equal length." }
-{ $examples
-    { $example
-        "USING: arrays prettyprint sequences ;"
-        "{ { 1 2 3 } { 4 5 6 } { 7 8 9 } } 0 <column> >array ."
-        "{ 1 4 7 }"
-    }
-}
-{ $notes
-    "In the same sense that " { $link <reversed> } " is a virtual variant of " { $link reverse } ", " { $link <column> } " is a virtual variant of " { $snippet "swap [ nth ] curry map" } "."
-} ;
-
 HELP: repetition
 { $class-description "A virtual sequence consisting of " { $link repetition-elt } " repeated " { $link repetition-len } " times. Repetitions are created by calling " { $link <repetition> } "." } ;
 
index e8db18b3d03872beb3ba6e5ff6cf18683e0cff68..100184798ce6ad89994bfd1f12b8351b35e18dee 100755 (executable)
@@ -224,13 +224,6 @@ unit-test
 [ V{ 1 2 3 } ]
 [ 3 V{ 1 3 2 } clone [ push-new ] keep ] unit-test
 
-! Columns
-{ { 1 2 3 } { 4 5 6 } { 7 8 9 } } [ clone ] map "seq" set
-
-[ { 1 4 7 } ] [ "seq" get 0 <column> >array ] unit-test
-[ ] [ "seq" get 1 <column> [ sq ] change-each ] unit-test
-[ { 4 25 64 } ] [ "seq" get 1 <column> >array ] unit-test
-
 ! erg's random tester found this one
 [ SBUF" 12341234" ] [
     9 <sbuf> dup "1234" swap push-all dup dup swap push-all
index 252df543912ff901986da371bc02d48ea0b965d4..924d9a05cb84df55e8606db17c06c6ebc284e103 100755 (executable)
@@ -215,18 +215,6 @@ M: slice length dup slice-to swap slice-from - ;
 
 INSTANCE: slice virtual-sequence
 
-! A column of a matrix
-TUPLE: column seq col ;
-
-C: <column> column
-
-M: column virtual-seq column-seq ;
-M: column virtual@
-    dup column-col -rot column-seq nth bounds-check ;
-M: column length column-seq length ;
-
-INSTANCE: column virtual-sequence
-
 ! One element repeated many times
 TUPLE: repetition len elt ;
 
@@ -703,5 +691,5 @@ PRIVATE>
 : flip ( matrix -- newmatrix )
     dup empty? [
         dup [ length ] map infimum
-        [ <column> dup like ] with map
+        swap [ [ nth-unsafe ] with { } map-as ] curry { } map-as
     ] unless ;
index c2eb411f0a727657098acff3f4861cb8d3ad61c9..a2d15d298177c12b7fe47b925ef6e499f293b677 100755 (executable)
@@ -150,18 +150,6 @@ ARTICLE: "syntax-byte-arrays" "Byte array syntax"
 { $subsection POSTPONE: B{ }
 "Byte arrays are documented in " { $link "byte-arrays" } "." ;
 
-ARTICLE: "syntax-bit-vectors" "Bit vector syntax"
-{ $subsection POSTPONE: ?V{ }
-"Bit vectors are documented in " { $link "bit-vectors" } "." ;
-
-ARTICLE: "syntax-float-vectors" "Float vector syntax"
-{ $subsection POSTPONE: FV{ }
-"Float vectors are documented in " { $link "float-vectors" } "." ;
-
-ARTICLE: "syntax-byte-vectors" "Byte vector syntax"
-{ $subsection POSTPONE: BV{ }
-"Byte vectors are documented in " { $link "byte-vectors" } "." ;
-
 ARTICLE: "syntax-pathnames" "Pathname syntax"
 { $subsection POSTPONE: P" }
 "Pathnames are documented in " { $link "pathnames" } "." ;
@@ -182,9 +170,6 @@ $nl
 { $subsection "syntax-float-arrays" }
 { $subsection "syntax-vectors" }
 { $subsection "syntax-sbufs" }
-{ $subsection "syntax-bit-vectors" }
-{ $subsection "syntax-byte-vectors" }
-{ $subsection "syntax-float-vectors" }
 { $subsection "syntax-hashtables" }
 { $subsection "syntax-tuples" }
 { $subsection "syntax-pathnames" } ;
@@ -291,30 +276,12 @@ HELP: B{
 { $description "Marks the beginning of a literal byte array. Literal byte arrays are terminated by " { $link POSTPONE: } } "." } 
 { $examples { $code "B{ 1 2 3 }" } } ;
 
-HELP: BV{
-{ $syntax "BV{ elements... }" }
-{ $values { "elements" "a list of bytes" } }
-{ $description "Marks the beginning of a literal byte vector. Literal byte vectors are terminated by " { $link POSTPONE: } } "." } 
-{ $examples { $code "BV{ 1 2 3 12 }" } } ;
-
 HELP: ?{
 { $syntax "?{ elements... }" }
 { $values { "elements" "a list of booleans" } }
 { $description "Marks the beginning of a literal bit array. Literal bit arrays are terminated by " { $link POSTPONE: } } "." } 
 { $examples { $code "?{ t f t }" } } ;
 
-HELP: ?V{
-{ $syntax "?V{ elements... }" }
-{ $values { "elements" "a list of booleans" } }
-{ $description "Marks the beginning of a literal bit vector. Literal bit vectors are terminated by " { $link POSTPONE: } } "." } 
-{ $examples { $code "?V{ t f t }" } } ;
-
-HELP: FV{
-{ $syntax "FV{ elements... }" }
-{ $values { "elements" "a list of real numbers" } }
-{ $description "Marks the beginning of a literal float vector. Literal float vectors are terminated by " { $link POSTPONE: } } "." } 
-{ $examples { $code "FV{ 1.0 2.0 3.0 }" } } ;
-
 HELP: F{
 { $syntax "F{ elements... }" }
 { $values { "elements" "a list of real numbers" } }
index eaf5ffea051bd2fe3953cc91b4a0ae0ddb8a6d1f..566f5471f4af1f00829621cfb3ff5d0c2103b154 100755 (executable)
@@ -1,10 +1,10 @@
 ! Copyright (C) 2004, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien arrays bit-arrays bit-vectors byte-arrays
-byte-vectors definitions generic hashtables kernel math
+USING: alien arrays bit-arrays byte-arrays
+definitions generic hashtables kernel math
 namespaces parser sequences strings sbufs vectors words
 quotations io assocs splitting classes.tuple generic.standard
-generic.math classes io.files vocabs float-arrays float-vectors
+generic.math classes io.files vocabs float-arrays
 classes.union classes.mixin classes.predicate classes.singleton
 compiler.units combinators debugger ;
 IN: bootstrap.syntax
@@ -79,11 +79,8 @@ IN: bootstrap.syntax
     "{" [ \ } [ >array ] parse-literal ] define-syntax
     "V{" [ \ } [ >vector ] parse-literal ] define-syntax
     "B{" [ \ } [ >byte-array ] parse-literal ] define-syntax
-    "BV{" [ \ } [ >byte-vector ] parse-literal ] define-syntax
     "?{" [ \ } [ >bit-array ] parse-literal ] define-syntax
-    "?V{" [ \ } [ >bit-vector ] parse-literal ] define-syntax
     "F{" [ \ } [ >float-array ] parse-literal ] define-syntax
-    "FV{" [ \ } [ >float-vector ] parse-literal ] define-syntax
     "H{" [ \ } [ >hashtable ] parse-literal ] define-syntax
     "T{" [ \ } [ >tuple ] parse-literal ] define-syntax
     "W{" [ \ } [ first <wrapper> ] parse-literal ] define-syntax
index d51a723cbdf0c8e48114e74c4ab920e345c8201b..53e9c9a14c6e1e3f5e7ebb2d500d6ebf3e8833e8 100644 (file)
@@ -1,4 +1,4 @@
-USING: namespaces math sequences splitting kernel ;
+USING: namespaces math sequences splitting kernel columns ;
 IN: benchmark.dispatch2
 
 : sequences
index bb4c5ba904227f890fa5d304c8f543272b1f9cf1..409d6d4a0f1866b5dbb6bb8e763686fdb52c232d 100644 (file)
@@ -1,5 +1,5 @@
 USING: sequences math mirrors splitting kernel namespaces
-assocs alien.syntax ;
+assocs alien.syntax columns ;
 IN: benchmark.dispatch3
 
 GENERIC: g ( obj -- str )
index 7eddeefc1b0a97717590a25085466dfebb8d399f..2c7dc1e80dd738de212d5eb727acc9c89d9a36d0 100644 (file)
@@ -19,7 +19,7 @@ IN: benchmark.spectral-norm
         pick 0.0 [
             swap >r >r 2dup r> (eval-A-times-u) r> +
         ] reduce nip
-    ] F{ } map-as 2nip ; inline
+    ] F{ } map-as { float-array } declare 2nip ; inline
 
 : (eval-At-times-u) ( u i j -- x )
     tuck swap eval-A >r swap nth-unsafe r> * ; inline
@@ -29,7 +29,7 @@ IN: benchmark.spectral-norm
         pick 0.0 [
             swap >r >r 2dup r> (eval-At-times-u) r> +
         ] reduce nip
-    ] F{ } map-as 2nip ; inline
+    ] F{ } map-as { float-array } declare 2nip ; inline
 
 : eval-AtA-times-u ( n u -- seq )
     dupd eval-A-times-u eval-At-times-u ; inline
diff --git a/extra/bit-vectors/bit-vectors-docs.factor b/extra/bit-vectors/bit-vectors-docs.factor
new file mode 100755 (executable)
index 0000000..9ceb2df
--- /dev/null
@@ -0,0 +1,42 @@
+USING: arrays bit-arrays help.markup help.syntax kernel\r
+bit-vectors.private combinators ;\r
+IN: bit-vectors\r
+\r
+ARTICLE: "bit-vectors" "Bit vectors"\r
+"A bit vector is a resizable mutable sequence of bits. The literal syntax is covered in " { $link "syntax-bit-vectors" } ". Bit vector words are found in the " { $vocab-link "bit-vectors" } " vocabulary."\r
+$nl\r
+"Bit vectors form a class:"\r
+{ $subsection bit-vector }\r
+{ $subsection bit-vector? }\r
+"Creating bit vectors:"\r
+{ $subsection >bit-vector }\r
+{ $subsection <bit-vector> }\r
+"Literal syntax:"\r
+{ $subsection POSTPONE: ?V{ }\r
+"If you don't care about initial capacity, a more elegant way to create a new bit vector is to write:"\r
+{ $code "?V{ } clone" } ;\r
+\r
+ABOUT: "bit-vectors"\r
+\r
+HELP: bit-vector\r
+{ $description "The class of resizable bit vectors. See " { $link "syntax-bit-vectors" } " for syntax and " { $link "bit-vectors" } " for general information." } ;\r
+\r
+HELP: <bit-vector>\r
+{ $values { "n" "a positive integer specifying initial capacity" } { "bit-vector" bit-vector } }\r
+{ $description "Creates a new bit vector that can hold " { $snippet "n" } " bits before resizing." } ;\r
+\r
+HELP: >bit-vector\r
+{ $values { "seq" "a sequence" } { "bit-vector" bit-vector } }\r
+{ $description "Outputs a freshly-allocated bit vector with the same elements as a given sequence." } ;\r
+\r
+HELP: bit-array>vector\r
+{ $values { "bit-array" "an array" } { "length" "a non-negative integer" } { "bit-vector" bit-vector } }\r
+{ $description "Creates a new bit vector using the array for underlying storage with the specified initial length." }\r
+{ $warning "This word is in the " { $vocab-link "bit-vectors.private" } " vocabulary because it does not perform type or bounds checks. User code should call " { $link >bit-vector } " instead." } ;\r
+\r
+HELP: ?V{\r
+{ $syntax "?V{ elements... }" }\r
+{ $values { "elements" "a list of booleans" } }\r
+{ $description "Marks the beginning of a literal bit vector. Literal bit vectors are terminated by " { $link POSTPONE: } } "." } \r
+{ $examples { $code "?V{ t f t }" } } ;\r
+\r
diff --git a/extra/bit-vectors/bit-vectors-tests.factor b/extra/bit-vectors/bit-vectors-tests.factor
new file mode 100755 (executable)
index 0000000..dff9a8d
--- /dev/null
@@ -0,0 +1,14 @@
+IN: bit-vectors.tests\r
+USING: tools.test bit-vectors vectors sequences kernel math ;\r
+\r
+[ 0 ] [ 123 <bit-vector> length ] unit-test\r
+\r
+: do-it\r
+    1234 swap [ >r even? r> push ] curry each ;\r
+\r
+[ t ] [\r
+    3 <bit-vector> dup do-it\r
+    3 <vector> dup do-it sequence=\r
+] unit-test\r
+\r
+[ t ] [ ?V{ } bit-vector? ] unit-test\r
diff --git a/extra/bit-vectors/bit-vectors.factor b/extra/bit-vectors/bit-vectors.factor
new file mode 100755 (executable)
index 0000000..b011f14
--- /dev/null
@@ -0,0 +1,51 @@
+! Copyright (C) 2008 Slava Pestov.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: arrays kernel kernel.private math sequences\r
+sequences.private growable bit-arrays prettyprint.backend\r
+parser ;\r
+IN: bit-vectors\r
+\r
+TUPLE: bit-vector underlying fill ;\r
+\r
+M: bit-vector underlying underlying>> { bit-array } declare ;\r
+\r
+M: bit-vector set-underlying (>>underlying) ;\r
+\r
+M: bit-vector length fill>> { array-capacity } declare ;\r
+\r
+M: bit-vector set-fill (>>fill) ;\r
+\r
+<PRIVATE\r
+\r
+: bit-array>vector ( bit-array length -- bit-vector )\r
+    bit-vector boa ; inline\r
+\r
+PRIVATE>\r
+\r
+: <bit-vector> ( n -- bit-vector )\r
+    <bit-array> 0 bit-array>vector ; inline\r
+\r
+: >bit-vector ( seq -- bit-vector )\r
+    T{ bit-vector f ?{ } 0 } clone-like ;\r
+\r
+M: bit-vector like\r
+    drop dup bit-vector? [\r
+        dup bit-array?\r
+        [ dup length bit-array>vector ] [ >bit-vector ] if\r
+    ] unless ;\r
+\r
+M: bit-vector new-sequence\r
+    drop [ <bit-array> ] keep >fixnum bit-array>vector ;\r
+\r
+M: bit-vector equal?\r
+    over bit-vector? [ sequence= ] [ 2drop f ] if ;\r
+\r
+M: bit-array new-resizable drop <bit-vector> ;\r
+\r
+INSTANCE: bit-vector growable\r
+\r
+: ?V \ } [ >bit-vector ] parse-literal ; parsing\r
+\r
+M: bit-vector >pprint-sequence ;\r
+\r
+M: bit-vector pprint-delims drop \ ?V{ \ } ;\r
diff --git a/extra/bit-vectors/summary.txt b/extra/bit-vectors/summary.txt
new file mode 100644 (file)
index 0000000..76a7d0f
--- /dev/null
@@ -0,0 +1 @@
+Growable bit arrays
diff --git a/extra/bit-vectors/tags.txt b/extra/bit-vectors/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/extra/byte-vectors/byte-vectors-docs.factor b/extra/byte-vectors/byte-vectors-docs.factor
new file mode 100755 (executable)
index 0000000..f34bc20
--- /dev/null
@@ -0,0 +1,42 @@
+USING: arrays byte-arrays help.markup help.syntax kernel\r
+byte-vectors.private combinators ;\r
+IN: byte-vectors\r
+\r
+ARTICLE: "byte-vectors" "Byte vectors"\r
+"A byte vector is a resizable mutable sequence of unsigned bytes. Byte vector words are found in the " { $vocab-link "byte-vectors" } " vocabulary."\r
+$nl\r
+"Byte vectors form a class:"\r
+{ $subsection byte-vector }\r
+{ $subsection byte-vector? }\r
+"Creating byte vectors:"\r
+{ $subsection >byte-vector }\r
+{ $subsection <byte-vector> }\r
+"Literal syntax:"\r
+{ $subsection POSTPONE: BV{ }\r
+"If you don't care about initial capacity, a more elegant way to create a new byte vector is to write:"\r
+{ $code "BV{ } clone" } ;\r
+\r
+ABOUT: "byte-vectors"\r
+\r
+HELP: byte-vector\r
+{ $description "The class of resizable byte vectors. See " { $link "syntax-byte-vectors" } " for syntax and " { $link "byte-vectors" } " for general information." } ;\r
+\r
+HELP: <byte-vector>\r
+{ $values { "n" "a positive integer specifying initial capacity" } { "byte-vector" byte-vector } }\r
+{ $description "Creates a new byte vector that can hold " { $snippet "n" } " bytes before resizing." } ;\r
+\r
+HELP: >byte-vector\r
+{ $values { "seq" "a sequence" } { "byte-vector" byte-vector } }\r
+{ $description "Outputs a freshly-allocated byte vector with the same elements as a given sequence." }\r
+{ $errors "Throws an error if the sequence contains elements other than integers." } ;\r
+\r
+HELP: byte-array>vector\r
+{ $values { "byte-array" "an array" } { "length" "a non-negative integer" } { "byte-vector" byte-vector } }\r
+{ $description "Creates a new byte vector using the array for underlying storage with the specified initial length." }\r
+{ $warning "This word is in the " { $vocab-link "byte-vectors.private" } " vocabulary because it does not perform type or bounds checks. User code should call " { $link >byte-vector } " instead." } ;\r
+\r
+HELP: BV{\r
+{ $syntax "BV{ elements... }" }\r
+{ $values { "elements" "a list of bytes" } }\r
+{ $description "Marks the beginning of a literal byte vector. Literal byte vectors are terminated by " { $link POSTPONE: } } "." } \r
+{ $examples { $code "BV{ 1 2 3 12 }" } } ;\r
diff --git a/extra/byte-vectors/byte-vectors-tests.factor b/extra/byte-vectors/byte-vectors-tests.factor
new file mode 100755 (executable)
index 0000000..d457d68
--- /dev/null
@@ -0,0 +1,14 @@
+IN: byte-vectors.tests\r
+USING: tools.test byte-vectors vectors sequences kernel ;\r
+\r
+[ 0 ] [ 123 <byte-vector> length ] unit-test\r
+\r
+: do-it\r
+    123 [ over push ] each ;\r
+\r
+[ t ] [\r
+    3 <byte-vector> do-it\r
+    3 <vector> do-it sequence=\r
+] unit-test\r
+\r
+[ t ] [ BV{ } byte-vector? ] unit-test\r
diff --git a/extra/byte-vectors/byte-vectors.factor b/extra/byte-vectors/byte-vectors.factor
new file mode 100755 (executable)
index 0000000..a8351dc
--- /dev/null
@@ -0,0 +1,51 @@
+! Copyright (C) 2008 Slava Pestov.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: arrays kernel kernel.private math sequences\r
+sequences.private growable byte-arrays prettyprint.backend\r
+parser accessors ;\r
+IN: byte-vectors\r
+\r
+TUPLE: byte-vector underlying fill ;\r
+\r
+M: byte-vector underlying underlying>> { byte-array } declare ;\r
+\r
+M: byte-vector set-underlying (>>underlying) ;\r
+\r
+M: byte-vector length fill>> { array-capacity } declare ;\r
+\r
+M: byte-vector set-fill (>>fill) ;\r
+\r
+<PRIVATE\r
+\r
+: byte-array>vector ( byte-array length -- byte-vector )\r
+    byte-vector boa ; inline\r
+\r
+PRIVATE>\r
+\r
+: <byte-vector> ( n -- byte-vector )\r
+    <byte-array> 0 byte-array>vector ; inline\r
+\r
+: >byte-vector ( seq -- byte-vector )\r
+    T{ byte-vector f B{ } 0 } clone-like ;\r
+\r
+M: byte-vector like\r
+    drop dup byte-vector? [\r
+        dup byte-array?\r
+        [ dup length byte-array>vector ] [ >byte-vector ] if\r
+    ] unless ;\r
+\r
+M: byte-vector new-sequence\r
+    drop [ <byte-array> ] keep >fixnum byte-array>vector ;\r
+\r
+M: byte-vector equal?\r
+    over byte-vector? [ sequence= ] [ 2drop f ] if ;\r
+\r
+M: byte-array new-resizable drop <byte-vector> ;\r
+\r
+INSTANCE: byte-vector growable\r
+\r
+: BV{ \ } [ >byte-vector ] parse-literal ; parsing\r
+\r
+M: byte-vector >pprint-sequence ;\r
+\r
+M: byte-vector pprint-delims drop \ BV{ \ } ;\r
diff --git a/extra/byte-vectors/summary.txt b/extra/byte-vectors/summary.txt
new file mode 100644 (file)
index 0000000..e914ebb
--- /dev/null
@@ -0,0 +1 @@
+Growable byte arrays
diff --git a/extra/byte-vectors/tags.txt b/extra/byte-vectors/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/extra/columns/authors.txt b/extra/columns/authors.txt
new file mode 100644 (file)
index 0000000..a44f8d7
--- /dev/null
@@ -0,0 +1,2 @@
+Slava Pestov
+Daniel Ehrenberg
diff --git a/extra/columns/columns-docs.factor b/extra/columns/columns-docs.factor
new file mode 100644 (file)
index 0000000..6b2adce
--- /dev/null
@@ -0,0 +1,26 @@
+USING: help.markup help.syntax sequences ;
+IN: columns
+
+ARTICLE: "columns" "Column sequences"
+"A " { $emphasis "column" } " presents a column of a matrix represented as a sequence of rows:"
+{ $subsection column }
+{ $subsection <column> } ;
+
+HELP: column
+{ $class-description "A virtual sequence which presents a fixed column of a matrix represented as a sequence of rows. New instances can be created by calling " { $link <column> } "." } ;
+
+HELP: <column> ( seq n -- column )
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "column" column } }
+{ $description "Outputs a new virtual sequence which presents a fixed column of a matrix represented as a sequence of rows." "The " { $snippet "i" } "th element of a column is the " { $snippet "n" } "th element of the " { $snippet "i" } "th element of" { $snippet "seq" } ". Every element of " { $snippet "seq" } " must be a sequence, and all sequences must have equal length." }
+{ $examples
+    { $example
+        "USING: arrays prettyprint sequences ;"
+        "{ { 1 2 3 } { 4 5 6 } { 7 8 9 } } 0 <column> >array ."
+        "{ 1 4 7 }"
+    }
+}
+{ $notes
+    "In the same sense that " { $link <reversed> } " is a virtual variant of " { $link reverse } ", " { $link <column> } " is a virtual variant of " { $snippet "swap [ nth ] curry map" } "."
+} ;
+
+ABOUT: "columns"
diff --git a/extra/columns/columns-tests.factor b/extra/columns/columns-tests.factor
new file mode 100644 (file)
index 0000000..657b9e0
--- /dev/null
@@ -0,0 +1,9 @@
+IN: columns.tests
+USING: columns sequences kernel namespaces arrays tools.test math ;
+
+! Columns
+{ { 1 2 3 } { 4 5 6 } { 7 8 9 } } [ clone ] map "seq" set
+
+[ { 1 4 7 } ] [ "seq" get 0 <column> >array ] unit-test
+[ ] [ "seq" get 1 <column> [ sq ] change-each ] unit-test
+[ { 4 25 64 } ] [ "seq" get 1 <column> >array ] unit-test
diff --git a/extra/columns/columns.factor b/extra/columns/columns.factor
new file mode 100644 (file)
index 0000000..7e4a7fd
--- /dev/null
@@ -0,0 +1,15 @@
+! Copyright (C) 2005, 2008 Slava Pestov, Daniel Ehrenberg.
+! See http://factorcode.org/license.txt for BSD license.
+USING: sequences kernel accessors ;
+IN: columns
+
+! A column of a matrix
+TUPLE: column seq col ;
+
+C: <column> column
+
+M: column virtual-seq seq>> ;
+M: column virtual@ dup col>> -rot seq>> nth bounds-check ;
+M: column length seq>> length ;
+
+INSTANCE: column virtual-sequence
diff --git a/extra/columns/summary.txt b/extra/columns/summary.txt
new file mode 100644 (file)
index 0000000..c4ade7f
--- /dev/null
@@ -0,0 +1 @@
+Virtual sequence view of a matrix column
diff --git a/extra/columns/tags.txt b/extra/columns/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/extra/float-vectors/float-vectors-docs.factor b/extra/float-vectors/float-vectors-docs.factor
new file mode 100755 (executable)
index 0000000..8d25da5
--- /dev/null
@@ -0,0 +1,42 @@
+USING: arrays float-arrays help.markup help.syntax kernel\r
+float-vectors.private combinators ;\r
+IN: float-vectors\r
+\r
+ARTICLE: "float-vectors" "Float vectors"\r
+"A float vector is a resizable mutable sequence of unsigned floats. The literal syntax is covered in " { $link "syntax-float-vectors" } ". Float vector words are found in the " { $vocab-link "float-vectors" } " vocabulary."\r
+$nl\r
+"Float vectors form a class:"\r
+{ $subsection float-vector }\r
+{ $subsection float-vector? }\r
+"Creating float vectors:"\r
+{ $subsection >float-vector }\r
+{ $subsection <float-vector> }\r
+"Literal syntax:"\r
+{ $subsection POSTPONE: FV{ }\r
+"If you don't care about initial capacity, a more elegant way to create a new float vector is to write:"\r
+{ $code "FV{ } clone" } ;\r
+\r
+ABOUT: "float-vectors"\r
+\r
+HELP: float-vector\r
+{ $description "The class of resizable float vectors. See " { $link "syntax-float-vectors" } " for syntax and " { $link "float-vectors" } " for general information." } ;\r
+\r
+HELP: <float-vector>\r
+{ $values { "n" "a positive integer specifying initial capacity" } { "float-vector" float-vector } }\r
+{ $description "Creates a new float vector that can hold " { $snippet "n" } " floats before resizing." } ;\r
+\r
+HELP: >float-vector\r
+{ $values { "seq" "a sequence" } { "float-vector" float-vector } }\r
+{ $description "Outputs a freshly-allocated float vector with the same elements as a given sequence." }\r
+{ $errors "Throws an error if the sequence contains elements other than real numbers." } ;\r
+\r
+HELP: float-array>vector\r
+{ $values { "float-array" "an array" } { "length" "a non-negative integer" } { "float-vector" float-vector } }\r
+{ $description "Creates a new float vector using the array for underlying storage with the specified initial length." }\r
+{ $warning "This word is in the " { $vocab-link "float-vectors.private" } " vocabulary because it does not perform type or bounds checks. User code should call " { $link >float-vector } " instead." } ;\r
+\r
+HELP: FV{\r
+{ $syntax "FV{ elements... }" }\r
+{ $values { "elements" "a list of real numbers" } }\r
+{ $description "Marks the beginning of a literal float vector. Literal float vectors are terminated by " { $link POSTPONE: } } "." } \r
+{ $examples { $code "FV{ 1.0 2.0 3.0 }" } } ;\r
diff --git a/extra/float-vectors/float-vectors-tests.factor b/extra/float-vectors/float-vectors-tests.factor
new file mode 100755 (executable)
index 0000000..383dd4b
--- /dev/null
@@ -0,0 +1,14 @@
+IN: float-vectors.tests\r
+USING: tools.test float-vectors vectors sequences kernel ;\r
+\r
+[ 0 ] [ 123 <float-vector> length ] unit-test\r
+\r
+: do-it\r
+    12345 [ over push ] each ;\r
+\r
+[ t ] [\r
+    3 <float-vector> do-it\r
+    3 <vector> do-it sequence=\r
+] unit-test\r
+\r
+[ t ] [ FV{ } float-vector? ] unit-test\r
diff --git a/extra/float-vectors/float-vectors.factor b/extra/float-vectors/float-vectors.factor
new file mode 100755 (executable)
index 0000000..f0db376
--- /dev/null
@@ -0,0 +1,51 @@
+! Copyright (C) 2008 Slava Pestov.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: arrays kernel kernel.private math sequences\r
+sequences.private growable float-arrays prettyprint.backend\r
+parser ;\r
+IN: float-vectors\r
+\r
+TUPLE: float-vector underlying fill ;\r
+\r
+M: float-vector underlying underlying>> { float-array } declare ;\r
+\r
+M: float-vector set-underlying (>>underlying) ;\r
+\r
+M: float-vector length fill>> { array-capacity } declare ;\r
+\r
+M: float-vector set-fill (>>fill) ;\r
+\r
+<PRIVATE\r
+\r
+: float-array>vector ( float-array length -- float-vector )\r
+    float-vector boa ; inline\r
+\r
+PRIVATE>\r
+\r
+: <float-vector> ( n -- float-vector )\r
+    0.0 <float-array> 0 float-array>vector ; inline\r
+\r
+: >float-vector ( seq -- float-vector )\r
+    T{ float-vector f F{ } 0 } clone-like ;\r
+\r
+M: float-vector like\r
+    drop dup float-vector? [\r
+        dup float-array?\r
+        [ dup length float-array>vector ] [ >float-vector ] if\r
+    ] unless ;\r
+\r
+M: float-vector new-sequence\r
+    drop [ 0.0 <float-array> ] keep >fixnum float-array>vector ;\r
+\r
+M: float-vector equal?\r
+    over float-vector? [ sequence= ] [ 2drop f ] if ;\r
+\r
+M: float-array new-resizable drop <float-vector> ;\r
+\r
+INSTANCE: float-vector growable\r
+\r
+: FV{ \ } [ >float-vector ] parse-literal ; parsing\r
+\r
+M: float-vector >pprint-sequence ;\r
+\r
+M: float-vector pprint-delims drop \ FV{ \ } ;\r
diff --git a/extra/float-vectors/summary.txt b/extra/float-vectors/summary.txt
new file mode 100644 (file)
index 0000000..c476f41
--- /dev/null
@@ -0,0 +1 @@
+Growable float arrays
diff --git a/extra/float-vectors/tags.txt b/extra/float-vectors/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
index 4e6bfe48881153f52d84b860c438700af278b261..d5bc1875e44696ddc8a943238d8c7e45bd10d64a 100755 (executable)
@@ -145,9 +145,9 @@ ARTICLE: "collections" "Collections"
 { $subsection "vectors" }
 "Resizable specialized sequences:"
 { $subsection "sbufs" }
-{ $subsection "bit-vectors" }
-{ $subsection "byte-vectors" }
-{ $subsection "float-vectors" }
+{ $vocab-subsection "Bit vectors" "bit-vectors" }
+{ $vocab-subsection "Byte vectors" "byte-vectors" }
+{ $vocab-subsection "Float vectors" "float-vectors" }
 { $heading "Associative mappings" }
 { $subsection "assocs" }
 { $subsection "namespaces" }
index aa2704a799fc1b17831a99a8487e8e793d1c29c5..e0b27099329974b4714e356455c8ab0bf65be80e 100755 (executable)
@@ -38,7 +38,7 @@ M: predicate word-help* drop \ $predicate ;
     \ $error-description swap word-help elements empty? not ;
 
 : sort-articles ( seq -- newseq )
-    [ dup article-title ] { } map>assoc sort-values 0 <column> ;
+    [ dup article-title ] { } map>assoc sort-values keys ;
 
 : all-errors ( -- seq )
     all-words [ error? ] subset sort-articles ;
index 625be534ce026242eb422311f8d8adc02d4388ec..4d4068158e2f8354256aa594abc10ccf1a88a47c 100644 (file)
@@ -1,7 +1,7 @@
 ! Fast Fourier Transform, copyright (C) 2007 Hans Schmid
 ! http://dressguardmeister.blogspot.com/2007/01/fft.html
 USING: arrays sequences math math.vectors math.constants
-math.functions kernel splitting ;
+math.functions kernel splitting columns ;
 IN: math.fft
 
 : n^v ( n v -- w ) [ ^ ] with map ;
index 91d9fd8ece8a922d1a6cc7902bfa2a747a0ff15b..9254fd0ce7d09106fd3f5202078bc56db9ac4bec 100644 (file)
@@ -1,5 +1,5 @@
 ! Haar wavelet transform -- http://dmr.ath.cx/gfx/haar/
-USING: sequences math kernel splitting ;
+USING: sequences math kernel splitting columns ;
 IN: math.haar
 
 : averages ( seq -- seq )
index b0ba85c97f55dea438a78ea3d4445947e298a720..1cb82253b1d5ef884be8b856be4d4e2debf0918b 100644 (file)
@@ -1,6 +1,6 @@
 ! Based on http://www.ffconsultancy.com/ocaml/sudoku/index.html
 USING: sequences namespaces kernel math math.parser io
-io.styles combinators ;
+io.styles combinators columns ;
 IN: sudoku
 
 SYMBOL: solutions
index bbeadc40cd90e47c92093171800411fa760d8705..e57cc1f04b1322dfe083d5de7745b4d31f71364b 100755 (executable)
@@ -1,10 +1,13 @@
 ! Copyright (C) 2007, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: tools.deploy.backend system vocabs.loader kernel ;
+USING: tools.deploy.backend system vocabs.loader kernel
+combinators ;
 IN: tools.deploy
 
 : deploy ( vocab -- ) deploy* ;
 
-os macosx? [ "tools.deploy.macosx" require ] when
-os winnt? [ "tools.deploy.windows" require ] when
-os unix? [ "tools.deploy.unix" require ] when
\ No newline at end of file
+{
+    { [ os macosx? ] [ "tools.deploy.macosx" ] }
+    { [ os winnt? ] [ "tools.deploy.windows" ] }
+    { [ os unix? ] [ "tools.deploy.unix" ] }
+} cond require
\ No newline at end of file
index ca710e9d285eecf82c723c10ddc59f7b2c749785..d38b40db4b96c5d216d623238f6e59654ef6591e 100755 (executable)
@@ -31,10 +31,14 @@ IN: tools.deploy.macosx
     write-plist ;
 
 : create-app-dir ( vocab bundle-name -- vm )
-    dup "Frameworks" copy-bundle-dir
-    dup "Resources/English.lproj/MiniFactor.nib" copy-bundle-dir
-    dup "Contents/Resources/" copy-fonts
-    2dup create-app-plist "Contents/MacOS/" append-path "" copy-vm ;
+    [
+        nip
+        [ "Frameworks" copy-bundle-dir ]
+        [ "Resources/English.lproj/MiniFactor.nib" copy-bundle-dir ]
+        [ "Contents/Resources/" copy-fonts ] tri
+    ]
+    [ create-app-plist ]
+    [ "Contents/MacOS/" append-path "" copy-vm ] 2tri ;
 
 : deploy.app-image ( vocab bundle-name -- str )
     [ % "/Contents/Resources/" % % ".image" % ] "" make ;
@@ -43,9 +47,8 @@ IN: tools.deploy.macosx
     deploy-name get ".app" append ;
 
 : show-in-finder ( path -- )
-    NSWorkspace
-    -> sharedWorkspace
-    over <NSString> rot parent-directory <NSString>
+    [ NSWorkspace -> sharedWorkspace ]
+    [ normalize-path [ <NSString> ] [ parent-directory <NSString> ] bi ] bi*
     -> selectFile:inFileViewerRootedAtPath: drop ;
 
 M: macosx deploy* ( vocab -- )
@@ -56,6 +59,6 @@ M: macosx deploy* ( vocab -- )
             [ bundle-name create-app-dir ] keep
             [ bundle-name deploy.app-image ] keep
             namespace make-deploy-image
-            bundle-name normalize-path show-in-finder
+            bundle-name show-in-finder
         ] bind
     ] with-directory ;
index a995d66cd8e4130d880910557732eb0a6642a972..6f5a0304a25e2d8a403b2d6378cee045852e1dff 100644 (file)
@@ -3,21 +3,21 @@
 USING: io io.files io.backend kernel namespaces sequences
 system tools.deploy.backend tools.deploy.config assocs
 hashtables prettyprint ;
-IN: tools.deploy.linux
-  
-: create-app-dir ( vocab bundle-name -- vm )  
-  dup "" copy-fonts
-  "" copy-vm ;
-  
-: bundle-name ( -- str )  
-  deploy-name get ;
+IN: tools.deploy.unix
 
-M: linux deploy* ( vocab -- )
-   "." resource-path [
-       dup deploy-config [
-           [ bundle-name create-app-dir ] keep
-           [ bundle-name image-name ] keep
-           namespace make-deploy-image
-           bundle-name normalize-path [ "Binary deployed to " % % "." % ] "" make print
-     ] bind
-   ] with-directory ;  
\ No newline at end of file
+: create-app-dir ( vocab bundle-name -- vm )
+    dup "" copy-fonts
+    "" copy-vm ;
+
+: bundle-name ( -- str )
+    deploy-name get ;
+
+M: unix deploy* ( vocab -- )
+    "." resource-path [
+        dup deploy-config [
+            [ bundle-name create-app-dir ] keep
+            [ bundle-name image-name ] keep
+            namespace make-deploy-image
+            bundle-name normalize-path [ "Binary deployed to " % % "." % ] "" make print
+        ] bind
+    ] with-directory ;
\ No newline at end of file
index 4f6527a4ce6e7207f0a5fbd265e40d75392c627f..5af3062e39dafaa7255ec61301422da8877c074d 100755 (executable)
@@ -6,8 +6,7 @@ prettyprint windows.shell32 windows.user32 ;
 IN: tools.deploy.windows
 
 : copy-dlls ( bundle-name -- )
-    { "freetype6.dll" "zlib1.dll" "factor.dll" }
-    [ resource-path ] map
+    { "resource:freetype6.dll" "resource:zlib1.dll" "resource:factor.dll" }
     swap copy-files-into ;
 
 : create-exe-dir ( vocab bundle-name -- vm )
@@ -21,6 +20,6 @@ M: winnt deploy*
             [ deploy-name get create-exe-dir ] keep
             [ deploy-name get image-name ] keep
             [ namespace make-deploy-image ] keep
-            (normalize-path) open-in-explorer
+            open-in-explorer
         ] bind
     ] with-directory ;
index 90eb6254cd57bce74153f77935716a0dfd12a8dc..c7db687dc3f53c061b4037c43e3b0e5ab16d7878 100755 (executable)
@@ -66,7 +66,7 @@ M: word command-description ( word -- str )
     H{ { +nullary+ f } { +listener+ f } { +description+ f } } ;
 
 : define-command ( word hash -- )
-    default-flags swap assoc-union >r word-props r> update ;
+    [ word-props ] [ default-flags swap assoc-union ] bi* update ;
 
 : command-quot ( target command -- quot )
     dup 1quotation swap +nullary+ word-prop
index 342c360c8311ba047c1ac0b47e715508f5760606..99512562495faf382cdbb1af5a0df45ee9dd5fa8 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2006 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays kernel math namespaces sequences words io
-io.streams.string math.vectors ui.gadgets ;
+io.streams.string math.vectors ui.gadgets columns ;
 IN: ui.gadgets.grids
 
 TUPLE: grid children gap fill? ;
index f68a70c2bd5c312d0efde2d9fe31b83a575accb8..ed0f38b7430b19d0e71c22b2a8e26f8ae0f2c48a 100755 (executable)
@@ -3,7 +3,7 @@
 USING: arrays assocs kernel math models namespaces
 sequences words strings system hashtables math.parser
 math.vectors classes.tuple classes ui.gadgets boxes
-calendar alarms symbols combinators sets ;
+calendar alarms symbols combinators sets columns ;
 IN: ui.gestures
 
 : set-gestures ( class hash -- ) "gestures" set-word-prop ;
index d64fb68cb31fddee5ea2194c3ddde48ab383a9e0..f938ca15e6410b18dd97a543cdeb3a40e50ac4de 100644 (file)
@@ -1,6 +1,6 @@
 USING: alien alien.c-types alien.syntax combinators
 kernel windows windows.user32 windows.ole32
-windows.com windows.com.syntax ;
+windows.com windows.com.syntax io.files ;
 IN: windows.shell32
 
 : CSIDL_DESKTOP HEX: 00 ; inline
@@ -83,7 +83,7 @@ FUNCTION: HINSTANCE ShellExecuteW ( HWND hwnd, LPCTSTR lpOperation, LPCTSTR lpFi
 : ShellExecute ShellExecuteW ; inline
 
 : open-in-explorer ( dir -- )
-    f "open" rot f f SW_SHOWNORMAL ShellExecute drop ;
+    f "open" rot (normalize-path) f f SW_SHOWNORMAL ShellExecute drop ;
 
 : shell32-error ( n -- )
     ole32-error ; inline