]> gitweb.factorcode.org Git - factor.git/commitdiff
major cleanup
authorSlava Pestov <slava@factorcode.org>
Thu, 25 Aug 2005 19:27:38 +0000 (19:27 +0000)
committerSlava Pestov <slava@factorcode.org>
Thu, 25 Aug 2005 19:27:38 +0000 (19:27 +0000)
76 files changed:
CHANGES.html
TODO.FACTOR.txt
contrib/cont-responder/eval-responder.factor
contrib/cont-responder/live-updater-responder.factor
contrib/cont-responder/live-updater.factor
contrib/cont-responder/todo-example.factor
contrib/parser-combinators/lazy-examples.factor
contrib/parser-combinators/lazy.factor
library/alien/aliens.factor
library/alien/c-types.factor
library/alien/compiler.factor
library/bootstrap/boot-stage1.factor
library/bootstrap/boot-stage2.factor
library/bootstrap/image.factor
library/bootstrap/primitives.factor
library/collections/namespaces.factor
library/collections/sequence-eq.factor
library/collections/sequences-epilogue.factor
library/collections/slicing.factor
library/compiler/assembler.factor
library/compiler/compiler.factor
library/compiler/intrinsics.factor
library/compiler/linearizer.factor
library/errors.factor
library/generic/generic.factor
library/generic/math-combination.factor
library/generic/predicate.factor
library/generic/slots.factor
library/generic/standard-combination.factor
library/generic/tuple.factor
library/httpd/cont-responder.factor
library/httpd/default-responders.factor
library/httpd/file-responder.factor
library/httpd/html-tags.factor
library/httpd/html.factor
library/httpd/http-common.factor
library/httpd/responder.factor
library/inference/class-infer.factor
library/inference/dataflow.factor
library/inference/inference.factor
library/inference/kill-literals.factor
library/inference/print-dataflow.factor
library/inference/recursive-values.factor
library/io/lines.factor
library/io/logging.factor
library/sdl/sdl-keyboard.factor
library/syntax/parse-numbers.factor
library/syntax/parse-words.factor
library/syntax/prettyprint.factor
library/syntax/see.factor
library/test/benchmark/strings.factor
library/test/gadgets/frames.factor [new file with mode: 0644]
library/test/hashtables.factor
library/test/lists/namespaces.factor
library/test/math/math-combinators.factor
library/test/namespaces.factor
library/test/sequences.factor
library/test/strings.factor
library/test/test.factor
library/threads.factor
library/tools/annotations.factor
library/tools/inspector.factor
library/tools/interpreter.factor
library/tools/memory.factor
library/ui/fonts.factor
library/ui/frames.factor
library/ui/gadgets.factor
library/ui/hierarchy.factor
library/ui/line-editor.factor
library/ui/presentations.factor
library/ui/splitters.factor
library/ui/ui.factor
library/unix/io.factor
library/unix/sockets.factor
library/vocabularies.factor
library/win32/win32-io-internals.factor

index 9df93c39c3af47aeb1e572edb9826ba7cc741872..72c326ec29d9a5a3fc1f2105f66490c6b0d8d615 100644 (file)
@@ -19,7 +19,7 @@
 
 </li>
 
-<li>Sequences:
+<li>Collections:
 
 <ul>
 <li><code>2each ( seq seq quot -- quot: elt -- elt )</code> combinator</li>
 <li>Integers now support the sequence protocol. An integer is an increasing sequence of its predecessors. This means the <code>count ( n -- [ 0 ... n-1 ] )</code> word is gone; just use <code>&gt;vector</code> instead. Also, <code>project</code> has been made redundant by <code>map</code>.</li>
 <li>The <code>seq-transpose ( seq -- seq )</code> word is now named <code>flip</code>.
 </li>
+<li>The matrices library has been greatly simplified. Matrices are now represented as vectors of vectors, and matrix words have been moved to the <code>math</code> vocabulary.</li>
+<li>More descriptive "out of bounds" errors.</li>
+<li>New <code>make-hash ( quot -- namespace )</code> combinator executes quotation in a new namespace, which is then pushed on the stack.</li>
+<li>The <code>&lt;namespace&gt;</code> word is gone. It would create a hashtable with a default capacity. Now, just write <code>{{ }} clone</code>.
 </ul>
 
 </li>
 
-<li>Prettyprinter:
+<li>Development tools:
 
 <ul>
+<li>In the UI, object slots are now clickable in the inspector.</li>
+<li>Inspector now supports a history and an interactive loop; it prints a brief help message when it starts describing usage.</li>
 <li>The prettyprinter has been merged with the unparser. The <code>unparse ( object -- string )</code> word has been moved to the <code>prettyprint</code> vocabulary, and can now produce a parsable string for any class supported by the prettyprinter.</li>
 <li>New <code>unparse-short ( object -- string )</code> returns a string no longer than a single line.</li>
 <li>The prettyprinter now supports many more configuration variables. See the handbook for details.</li>
+<li>New <code>profile ( word -- )</code> word. Causes the word's accumulative runtime to be stored in a global variable named by the word. This is done with the annotation facility, the word's definition is modified; use <code>reload ( word -- )</code> to get the old definition back from the source file.</li>
 </ul>
 
 </li>
 
+
 <li>Everything else:
 
 <ul>
 <li>New <code>sleep ( ms -- )</code> word pauses current thread for a number of milliseconds.</li>
-<li>New <code>make-hash ( quot -- namespace )</code> combinator executes quotation in a new namespace, which is then pushed on the stack.</li>
-<li>Erlang/Termite-style concurrency library in <code>contrib/concurrency</code> (Chris Double).</li>
-<li>Object slots are now clickable in the inspector</li>
-<li>The matrices library has been greatly simplified. Matrices are now represented as vectors of vectors, and matrix words have been moved to the <code>math</code> vocabulary.</li>
-<li>More descriptive "out of bounds" errors.</li>
 <li>New <code>with-datastack ( stack word -- stack )</code> combinator.</li>
 <li>New <code>cond ( conditions -- )</code> combinator. It behaves like a set of nested <code>ifte</code>s; see its documentation comment for details. Note that it does not compile.</li>
+<li>Erlang/Termite-style concurrency library in <code>contrib/concurrency</code> (Chris Double).</li>
 <li>Completely redid infix algebra in <code>conrib/algebra/</code>. Now, vector operations are possible
 and the syntax doesn't use so many spaces. New way to write the quadratic formula:
 <pre>MATH: quadratic[a;b;c] =
index 52abb451379ff6740fbf64ee12792f8f9ca27da3..8d891ad79e3ae143f143727771e5c343211219a7 100644 (file)
@@ -1,11 +1,11 @@
 - reader syntax for arrays, byte arrays, displaced aliens\r
 - fix infer hang\r
 - out of memory error when printing global namespace\r
-- HTML formatting\r
+- HTML prettyprinting\r
 \r
 + ui:\r
 \r
-- off-by-one error in pickup?\r
+- off-by-one error in pick-up?\r
 - closing ui does not stop timers\r
 - adding/removing timers automatically for animated gadgets\r
 - fix listener prompt display after presentation commands invoked\r
@@ -79,6 +79,7 @@
 \r
 + kernel:\r
 \r
+- first time hash/vector is grown, set size to something big\r
 - merge timers with sleeping tasks\r
 - what about tasks and timers between image restarts\r
 - split: return vectors\r
index 0081692057528357873f6b46c54e99b10254486c..3d74ad2ad945b86096095dada04d9cf470989ffe 100644 (file)
@@ -74,7 +74,7 @@ USE: sequences
   #! backslash quote.
   [
     [ dup [ [[ CHAR: ' "\\'" ]] [[ CHAR: " "\\\"" ]] ] assoc [ % ] [ % ] ?ifte ] each
-  ] make-string ;
+  ] "" make ;
  
 : make-eval-javascript ( string -- string )
   #! Give a string return some javascript that when
index b409a0541eb8071dc5b9e87a43ace85046071f4c..ee35bd982e2a3f71fc4cfd6df8db4d6a700cbd3f 100644 (file)
@@ -37,14 +37,14 @@ USE: prettyprint
 : live-search-apropos-word ( string -- )
   #! Given a string that is a factor word, show the
   #! aporpos of that word.
-  <namespace> [
+  [
     "browser" "responder" set
     <pre> 
         stdio get <html-stream> [   
           apropos.
         ] with-stream              
     </pre>
-  ] bind ;
+  ] with-scope ;
       
 : live-updater-responder ( -- )
   [
index d777e18d0a9efcdbdf85a062fcd917804561fd21..950a695f24daa265f816516a668f21457e0e4c39 100644 (file)
@@ -38,7 +38,7 @@ USE: lists
 
 : get-live-updater-js ( filename -- string )
   #! Return the liveUpdater javascript code as a string.
-  <file-reader> [ get-live-updater-js* ] make-string ;
+  <file-reader> [ get-live-updater-js* ] "" make ;
 
 : live-updater-url ( -- url )
   #! Generate an URL to the liveUpdater.js code.
index 0fb1f2794e0dae6bae7274344235a558fd1e48ad..adcb400e8f11ea35f4298b08a6846dfb851d34b7 100644 (file)
@@ -44,65 +44,65 @@ USE: sequences
  
 : todo-stylesheet ( -- string )
   #! Return the stylesheet for the todo list
-  [ 
-    "table.list {" %
-    "  text-align:center;" %
-    "  font-family: Verdana;" %
-    "  font-weight: normal;" %
-    "  font-size: 11px;" %
-    "  color: #404040;" %
-    "  background-color: #fafafa;" %
-    "  border: 1px #6699cc solid;" %
-    "  border-collapse: collapse;" %
-    "  boder-spacing: 0px;" %
-    "}" %
-    "tr.heading {" %
-    "  border-bottom: 2px solid #6699cc;" %
-    "  border-left: 1px solix #6699cc;" %
-    "  background-color: #BEC8D1;" %
-    "  text-align: left;" %
-    "  text-indent: 0px;" %
-    "  font-family: verdana;" %
-    "  font-weight: bold;" %
-    "  color: #404040;" %
-    "}" %
-    "tr.item {" %
-    "  border-bottom: 1px solid #9cf;" %
-    "  border-top: 0px;" %
-    "  border-left: 1px solid #9cf;" %
-    "  border-right: 0px;" %
-    "  text-align: left;" %
-    "  text-indent: 2px;" %
-    "  font-family: verdana, sans-serif, arial;" %
-    "  font-weight: normal;" %
-    "  color: #404040;" %
-    "  background-color: #fafafa;" %
-    "}" %
-    "tr.complete {" %
-    "  border-bottom: 1px solid #9cf;" %
-    "  border-top: 0px;" %
-    "  border-left: 1px solid #9cf;" %
-    "  border-right: 0px;" %
-    "  text-align: left;" %
-    "  text-indent: 2px;" %
-    "  font-family: verdana, sans-serif, arial;" %
-    "  font-weight: normal;" %
-    "  color: #404040;" %
-    "  background-color: #ccc;" %
-    "}" %
-    "td.lbl {" %
-    "  font-weight: bold; text-align: right;" %
-    "}" %
-    "tr.required {" %
-    "  background: #FCC;" %
-    "}" %
-    "input:focus {" %
-    "  background: yellow;" %
-    "}" %
-    "textarea:focus {" %
-    "  background: yellow;" %
-    "}" %
-  ] make-string ;
+  {
+    "table.list {"
+    "  text-align:center;"
+    "  font-family: Verdana;"
+    "  font-weight: normal;"
+    "  font-size: 11px;"
+    "  color: #404040;"
+    "  background-color: #fafafa;"
+    "  border: 1px #6699cc solid;"
+    "  border-collapse: collapse;"
+    "  boder-spacing: 0px;"
+    "}"
+    "tr.heading {"
+    "  border-bottom: 2px solid #6699cc;"
+    "  border-left: 1px solix #6699cc;"
+    "  background-color: #BEC8D1;"
+    "  text-align: left;"
+    "  text-indent: 0px;"
+    "  font-family: verdana;"
+    "  font-weight: bold;"
+    "  color: #404040;"
+    "}"
+    "tr.item {"
+    "  border-bottom: 1px solid #9cf;"
+    "  border-top: 0px;"
+    "  border-left: 1px solid #9cf;"
+    "  border-right: 0px;"
+    "  text-align: left;"
+    "  text-indent: 2px;"
+    "  font-family: verdana, sans-serif, arial;"
+    "  font-weight: normal;"
+    "  color: #404040;"
+    "  background-color: #fafafa;"
+    "}"
+    "tr.complete {"
+    "  border-bottom: 1px solid #9cf;"
+    "  border-top: 0px;"
+    "  border-left: 1px solid #9cf;"
+    "  border-right: 0px;"
+    "  text-align: left;"
+    "  text-indent: 2px;"
+    "  font-family: verdana, sans-serif, arial;"
+    "  font-weight: normal;"
+    "  color: #404040;"
+    "  background-color: #ccc;"
+    "}"
+    "td.lbl {"
+    "  font-weight: bold; text-align: right;"
+    "}"
+    "tr.required {"
+    "  background: #FCC;"
+    "}"
+    "input:focus {"
+    "  background: yellow;"
+    "}"
+    "textarea:focus {"
+    "  background: yellow;"
+    "}"
+  } concat ;
 
 : todo-stylesheet-url ( -- url )
   #! Generate an URL for the stylesheet.
@@ -234,7 +234,7 @@ USE: sequences
    
 : get-todo-filename ( database-path <todo> -- filename )
   #! Get the filename containing the todo list details.
-  [ swap % todo-username % ".todo" % ] make-string ;
+  [ swap % todo-username % ".todo" % ] "" make ;
   
 : add-default-todo-item ( <todo> -- )
   #! Add a default todo item. This is a workaround for the 
@@ -473,7 +473,7 @@ USE: sequences
 : show-todo-list ( -- )
   #! Show the current todo list.
   [
-    [ "todo" get todo-username % "'s To Do list" % ] make-string
+    [ "todo" get todo-username % "'s To Do list" % ] "" make
     [ include-todo-stylesheet ]
     [
       "todo" get write-item-table
index 94db1f334622ef6da497f577ae197e8b0787bec6..19f31446d3872cb716a55c6109fd0c945f3db963 100644 (file)
@@ -42,7 +42,7 @@ USE: namespaces
   #! each successive value being the result of applying quot to
   #! n.
   swap dup unit delay -rot 
-  [ , dup , \ call , , \ lfrom-by , ] make-list delay lcons ;
+  [ , dup , \ call , , \ lfrom-by , ] [ ] make delay lcons ;
 
 : lnaturals 0 lfrom ;
 : lpositves 1 lfrom ;
index 3c1d75a4b495eb046a642e8b5f0c32ca139c9223..0e0e435e2b2337633ad40481ef7d1a2839bdf44a 100644 (file)
@@ -80,7 +80,7 @@ DEFER: lnil
 
 : lcons ( lcar lcdr -- promise )
   #! Given a car and cdr, both lazy values, return a lazy cons.
-  swap [ , , \ <lcons> , ] make-list delay ;
+  swap [ , , \ <lcons> , ] [ ] make delay ;
 
 : lunit ( lvalue -- llist )
   #! Given a lazy value (a quotation that when called produces
@@ -102,8 +102,8 @@ DEFER: lnil
     drop
   ] [
     swap 2dup
-    [ , \ lcdr , , \ lmap , ] make-list delay >r
-    [ , \ lcar , , \ call , ] make-list delay r> 
+    [ , \ lcdr , , \ lmap , ] [ ] make delay >r
+    [ , \ lcar , , \ call , ] [ ] make delay r> 
     lcons 
   ] ifte ;
 
@@ -117,8 +117,8 @@ DEFER: lnil
       nip
     ] [
         swap dupd     ( llist llist n  -- )
-        [ [ 1 - ] cons , \ call , , \ lcdr , \ ltake , ] make-list delay >r
-        [ , \ lcar , ] make-list delay r> 
+        [ [ 1 - ] cons , \ call , , \ lcdr , \ ltake , ] [ ] make delay >r
+        [ , \ lcar , ] [ ] make delay r> 
         lcons 
     ] ifte 
   ] ifte ;
index ee26571d7467410aa2e41e5ea24fb5b8884b9fc8..45504bc02be0f967d362369366c66adf7eb6882c 100644 (file)
@@ -39,7 +39,7 @@ M: alien = ( obj obj -- ? )
     ] bind ;
 
 : library-abi ( library -- abi )
-    library [ [ "abi" get ] bind ] [ "cdecl" ] ifte* ;
+    library "abi" swap ?hash [ "cdecl" ] unless* ;
 
 : DLL" skip-blank parse-string dlopen swons ; parsing
 
index 86e54367600eb8fa711c2c738607cf9f0b4c5abb..90b0ddf0f355295ec13ac81f1ed759ca1a2dadfe 100644 (file)
@@ -72,7 +72,7 @@ SYMBOL: c-types
         [
             "width" get , \ <c-object> , \ tuck , 0 ,
             "setter" get %
-        ] make-list
+        ] [ ] make
     ] bind define-compound ;
 
 : init-c-type ( name vocab -- )
index 35eb0d91208b59a02ab3c55e1eccfdec03cddc4f..065bfb208b8117dd8af7571f390c0cf2dd4f730d 100644 (file)
@@ -137,7 +137,7 @@ M: alien-node linearize-node* ( node -- )
 : parse-arglist ( lst -- types stack effect )
     unpair [
         " " % [ "," ?tail drop % " " % ] each "-- " %
-    ] make-string ;
+    ] "" make ;
 
 : (define-c-word) ( type lib func types stack-effect -- )
     >r over create-in >r 
@@ -159,7 +159,7 @@ M: alien-node linearize-node* ( node -- )
 ] "infer" set-word-prop
 
 global [
-    "libraries" get [ <namespace> "libraries" set ] unless
+    "libraries" get [ {{ }} clone "libraries" set ] unless
 ] bind
 
 M: compound (uncrossref)
index d7e7ef76ebf26f2c7db1e95398ee98f4aa994f13..5777e4464545719e9f9c9d415f82e7b79d2a19fc 100644 (file)
@@ -9,7 +9,7 @@ sequences io vectors words ;
 
 "/library/bootstrap/primitives.factor" run-resource
 
-! The make-list form creates a boot quotation
+! The [ ] make form creates a boot quotation
 [
     [
         [ hashtable? ] instances
@@ -152,7 +152,7 @@ sequences io vectors words ;
     } [ dup print parse-resource % ] each
     
     [ "/library/bootstrap/boot-stage2.factor" run-resource ] %
-] make-list
+] [ ] make
 
 vocabularies get [
     "!syntax" get "syntax" set
index e04ec496b3df230b580d2ce4475dbe03509312bb..942bb83c84a4c644d89d4eaaf273f390bbbf3ef2 100644 (file)
@@ -54,20 +54,6 @@ cpu "ppc" = [
     ] when\r
 ] unless\r
 \r
-: compile? "compile" get supported-cpu? and ;\r
-\r
-compile? [\r
-    "Compiling base..." print\r
-\r
-    \ car compile\r
-    \ * compile\r
-    \ = compile\r
-    \ string>number compile\r
-    \ number>string compile\r
-    \ scan compile\r
-    \ (generate) compile\r
-] when\r
-\r
 "Loading more library code..." print\r
 \r
 t [\r
@@ -85,6 +71,20 @@ t [
     "/library/help/tutorial.factor"\r
 ] pull-in\r
 \r
+: compile? "compile" get supported-cpu? and ;\r
+\r
+compile? [\r
+    "Compiling base..." print\r
+\r
+    \ car compile\r
+    \ * compile\r
+    \ = compile\r
+    \ string>number compile\r
+    \ number>string compile\r
+    \ scan compile\r
+    \ (generate) compile\r
+] when\r
+\r
 compile? [\r
     unix? [\r
         "/library/unix/types.factor"\r
index 0126522b47f2fe2ee36c6d1b2393922bf07d7056..e2bff6dc898d8d0f4585ebdcb8ebeac665220c91 100644 (file)
@@ -154,7 +154,7 @@ M: f ' ( obj -- ptr )
     r> emit ;
 
 : word-error ( word msg -- )
-    [ % dup word-vocabulary % " " % word-name % ] make-string
+    [ % dup word-vocabulary % " " % word-name % ] "" make
     throw ;
 
 : transfer-word ( word -- word )
index f90a7c37df40a3d4f39ceaf8632709d85905eaf3..7695166ae64a532c8a906732768531fa3f9f2ec9 100644 (file)
@@ -16,7 +16,7 @@ math namespaces sequences strings vectors words ;
 ! Bring up a bare cross-compiling vocabulary.
 "syntax" vocab
 
-<namespace> vocabularies set
+{{ }} clone vocabularies set
 f crossref set
 
 vocabularies get [ "syntax" set [ reveal ] each ] bind
@@ -223,7 +223,7 @@ FORGET: set-stack-effect
 ! Okay, now we have primitives fleshed out. Bring up the generic
 ! word system.
 : builtin-predicate ( class predicate -- )
-    [ \ type , over types first , \ eq? , ] make-list
+    [ \ type , over types first , \ eq? , ] [ ] make
     define-predicate ;
 
 : register-builtin ( class -- )
@@ -239,7 +239,7 @@ FORGET: set-stack-effect
     define-slots
     register-builtin ;
 
-<namespace> typemap set
+{{ }} clone typemap set
 num-types empty-vector builtins set
 
 ! Catch-all metaclass for providing a default method.
index 7bb433246867f524668fdd02a52021bc4347d161..ff7dc680951fbe0f3e285b9637afc8300be8ff43 100644 (file)
@@ -42,10 +42,6 @@ strings vectors words ;
 
 : global ( -- g ) 4 getenv ;
 
-: <namespace> ( -- n )
-    #! Create a new namespace.
-    23 <hashtable> ; flushable
-
 : (get) ( var ns -- value )
     #! Internal word for searching the namestack.
     dup [
@@ -68,7 +64,7 @@ strings vectors words ;
 : nest ( variable -- hash )
     #! If the variable is set in the current namespace, return
     #! its value, otherwise set its value to a new namespace.
-    dup namespace hash [ ] [ >r <namespace> dup r> set ] ?ifte ;
+    dup namespace hash [ ] [ >r {{ }} clone dup r> set ] ?ifte ;
 
 : change ( var quot -- )
     #! Execute the quotation with the variable value on the
@@ -88,45 +84,28 @@ strings vectors words ;
     #! Execute a quotation with a namespace on the namestack.
     swap >n call n> drop ; inline
 
-: make-hash ( quot -- hash ) <namespace> >n call n> ; inline
+: make-hash ( quot -- hash ) {{ }} clone >n call n> ; inline
 
 : with-scope ( quot -- ) make-hash drop ; inline
 
 ! Building sequences
 SYMBOL: building
 
-: make-seq ( quot sequence -- sequence )
-    #! Call , and % from the quotation to append to a sequence.
-    [ building set call building get ] with-scope ; inline
+: make ( quot proto -- )
+    #! Call , and % from "quot" to append to a sequence
+    #! that has the same type as "proto".
+    [
+        dup thaw building set >r call building get r> like
+    ] with-scope ; inline
 
 : , ( obj -- )
     #! Add to the sequence being built with make-seq.
     building get push ;
 
-: unique, ( obj -- )
-    #! Add the object to the sequence being built with make-seq
-    #! unless an equal object has already been added.
-    building get 2dup member? [ 2drop ] [ push ] ifte ;
-
 : % ( seq -- )
     #! Append to the sequence being built with make-seq.
     building get swap nappend ;
 
-: make-vector ( quot -- vector )
-    100 <vector> make-seq ; inline
-
-: make-list ( quot -- list )
-    make-vector >list ; inline
-
-: make-sbuf ( quot -- sbuf )
-    100 <sbuf> make-seq ; inline
-
-: make-string ( quot -- string )
-    make-sbuf >string ; inline
-
-: make-rstring ( quot -- string )
-    make-sbuf <reversed> >string ; inline
-
 ! Building hashtables, and computing a transitive closure.
 SYMBOL: hash-buffer
 
@@ -144,7 +123,7 @@ SYMBOL: hash-buffer
 
 : closure ( key hash -- list )
     [
-        <namespace> hash-buffer set
+        {{ }} clone hash-buffer set
         (closure)
         hash-buffer get hash-keys
     ] with-scope ;
index 073bab0eee57aebb71a90916a9014197581aa25f..9a6f08067fe4c46567936873ef7b82ec70d60fc5 100644 (file)
@@ -9,20 +9,13 @@ UNION: sequence array string sbuf vector ;
 
 : length= ( seq seq -- ? ) length swap length number= ;
 
-: (sequence=) ( seq seq i -- ? )
-    over length over number= [
-        3drop t
-    ] [
-        3dup 2nth = [ 1 + (sequence=) ] [ 3drop f ] ifte
-    ] ifte ;
-
 : sequence= ( seq seq -- ? )
     #! Check if two sequences have the same length and elements,
     #! but not necessarily the same class.
-    over general-list? over general-list? or [
-        swap >list swap >list =
+    2dup length= [
+        dup length [ >r 2dup r> 2nth = ] all? 2nip
     ] [
-        2dup length= [ 0 (sequence=) ] [ 2drop f ] ifte
+        2drop f
     ] ifte ; flushable
 
 M: sequence = ( obj seq -- ? )
index 487cc2f44e13a5950aa8ef1b4a7aa6d15d334331..e4008c9005fc47a30237cde45d9cc3f41b628067 100644 (file)
@@ -43,7 +43,7 @@ M: object each ( seq quot -- )
         [ 2swap [ slip push ] 2keep ] 2each nip
     ] keep like ; inline
 
-: find* ( i seq quot -- i elt  )
+: find* ( i seq quot -- i elt )
     pick pick length >= [
         3drop -1 f
     ] [
@@ -116,7 +116,6 @@ M: object >list ( seq -- list ) dup length 0 rot (>list) ;
 : member? ( obj seq -- ? )     [ = ] contains-with? ; flushable
 : memq?   ( obj seq -- ? )     [ eq? ] contains-with? ; flushable
 : remove  ( obj list -- list ) [ = not ] subset-with ; flushable
-: remq    ( obj list -- list ) [ eq? not ] subset-with ; flushable
 
 : copy-into ( start to from -- )
     dup length [ >r pick r> + pick set-nth ] 2each 2drop ;
index f959da79dbcfb08ecdabcfe3ce884a0e6f310ce2..5ef682f1a43382a84a390e585dd2b9c75b76dedb 100644 (file)
@@ -4,41 +4,27 @@ IN: sequences
 USING: generic kernel kernel-internals lists math namespaces
 strings vectors ;
 
-: head-slice ( n seq -- slice )
-    #! n is an index from the start of the sequence.
-    0 -rot <slice> ; flushable
+: head-slice ( n seq -- slice ) 0 -rot <slice> ; flushable
 
-: head-slice* ( n seq -- slice )
-    #! n is an index from the end of the sequence.
-    [ length swap - ] keep head-slice ; flushable
+: tail-slice ( n seq -- slice ) [ length ] keep <slice> ; flushable
 
-: tail-slice ( n seq -- slice )
-    #! n is an index from the start of the sequence.
-    [ length ] keep <slice> ; flushable
+: (slice*) [ length swap - ] keep ;
 
-: tail-slice* ( n seq -- slice )
-    #! n is an index from the end of the sequence.
-    [ length swap - ] keep tail-slice ; flushable
+: head-slice* ( n seq -- slice ) (slice*) head-slice ; flushable
 
-: subseq ( from to seq -- seq )
-    #! Makes a new sequence with the same contents and type as
-    #! the slice of another sequence.
-    [ <slice> ] keep like ; flushable
+: tail-slice* ( n seq -- slice ) (slice*) tail-slice ; flushable
 
-M: object head ( index seq -- seq )
-    [ head-slice ] keep like ;
+: subseq ( from to seq -- seq ) [ <slice> ] keep like ; flushable
 
-: head* ( n seq -- seq )
-    [ head-slice* ] keep like ; flushable
+M: object head ( index seq -- seq ) [ head-slice ] keep like ;
 
-M: object tail ( index seq -- seq )
-    [ tail-slice ] keep like ;
+: head* ( n seq -- seq ) [ head-slice* ] keep like ; flushable
 
-: tail* ( n seq -- seq )
-    [ tail-slice* ] keep like ; flushable
+M: object tail ( index seq -- seq ) [ tail-slice ] keep like ;
 
-: length< ( seq seq -- ? )
-    swap length swap length < ; flushable
+: tail* ( n seq -- seq ) [ tail-slice* ] keep like ; flushable
+
+: length< ( seq seq -- ? ) swap length swap length < ; flushable
 
 : head? ( seq begin -- ? )
     2dup length< [
@@ -60,11 +46,6 @@ M: object tail ( index seq -- seq )
 : ?tail ( seq end -- seq ? )
     2dup tail? [ length swap head* t ] [ drop f ] ifte ; flushable
 
-: cut ( index seq -- seq seq )
-    #! Returns 2 sequences, that when concatenated yield the
-    #! original sequence.
-    [ head ] 2keep tail ; flushable
-
 : group-advance subseq , >r tuck + swap r> ;
 
 : group-finish nip dup length swap subseq , ;
@@ -78,7 +59,7 @@ M: object tail ( index seq -- seq )
 
 : group ( n seq -- list )
     #! Split a sequence into element chunks.
-    [ 0 -rot (group) ] make-vector ; flushable
+    [ 0 -rot (group) ] { } make ; flushable
 
 : start-step ( subseq seq n -- subseq slice )
     pick length dupd + rot <slice> ;
@@ -124,4 +105,4 @@ M: object tail ( index seq -- seq )
 : split ( seq subseq -- list )
     #! Split the sequence at each occurrence of subseq, and push
     #! a list of the pieces.
-    [ 0 -rot (split) ] make-list ; flushable
+    [ 0 -rot (split) ] [ ] make ; flushable
index ee45e72c875fb68e5c69d95e060c6b1dad1b4aac..31dfc34c345bc3e8a10db883279c3d1e9b6a95af 100644 (file)
@@ -42,6 +42,6 @@ SYMBOL: interned-literals
     compiled-offset 0 compile-cell ;
 
 : init-assembler ( -- )
-    global [ <namespace> interned-literals set ] bind ;
+    {{ }} clone interned-literals global set-hash ;
 
 : w>h/h dup -16 shift HEX: ffff bitand >r HEX: ffff bitand r> ;
index f524662b9746674eb31460d7d175034bdff98b41..c77899bcba8f419b10c41973b4c7d08e96c7557c 100644 (file)
@@ -64,6 +64,14 @@ M: compound (compile) ( word -- )
     #! purposes.
     gensym [ swap define-compound ] keep dup compile execute ;
 
+\ dataflow profile
 \ optimize profile
 \ linearize profile
 \ simplify profile
+\ generate profile
+\ kill-node profile
+\ partial-eval profile
+\ inline-method profile
+\ apply-identities profile
+\ subst-values profile
+\ split-branch profile
index b40755448e4d3cbd84f8877d6ceae876165d89a1..ffd6aa0becadd129119f2086af7b80af9b82ac13 100644 (file)
@@ -187,7 +187,7 @@ sequences vectors words ;
     [[ fixnum>       %fixnum>       ]]
     [[ eq?           %eq?           ]]
 ] [
-    uncons [ literalize , \ binary-op , ] make-list
+    uncons [ literalize , \ binary-op , ] [ ] make
     "intrinsic" set-word-prop
 ] each
 
index 8b8435fa3b56dd943387282b6fb95ba966d1953d..cf7ea9063f51f6eefd56eb8065551cceb6948a10 100644 (file)
@@ -20,7 +20,7 @@ M: node linearize-node* ( node -- ) drop ;
     #! Transform dataflow IR into linear IR. This strips out
     #! stack flow information, and flattens conditionals into
     #! jumps and labels.
-    [ %prologue , linearize-node ] make-list ;
+    [ %prologue , linearize-node ] [ ] make ;
 
 M: #label linearize-node* ( node -- )
     <label> dup %return-to , >r
index 9c374e70855d17d9ce7d7b888b61dae5104b9ff0..787a2c5b3be6f6f8c5e169bc62159f1de4ede784 100644 (file)
@@ -5,14 +5,11 @@ USING: kernel-internals lists ;
 DEFER: callcc1
 IN: errors
 
-TUPLE: no-method object generic ;
+! This is a very lightweight exception handling system.
 
-: no-method ( object generic -- )
-    #! We 2dup here to leave both values on the stack, for
-    #! post-mortem inspection.
-    <no-method> throw ;
+TUPLE: no-method object generic ;
 
-! This is a very lightweight exception handling system.
+: no-method ( object generic -- ) <no-method> throw ;
 
 : catchstack ( -- cs ) 6 getenv ;
 : set-catchstack ( cs -- ) 6 setenv ;
index c3989f01b5e012126371c4fc5ec5bc4e0839922b..cc1dd2d667bc5c185f779d25ff0d6b2ca6f4127b 100644 (file)
@@ -76,7 +76,7 @@ SYMBOL: builtin
 
 : init-methods ( word -- )
      dup "methods" word-prop
-     [ drop ] [ <namespace> "methods" set-word-prop ] ifte ;
+     [ drop ] [ {{ }} clone "methods" set-word-prop ] ifte ;
 
 ! Defining generic words
 
index 61d0ce75002040bc457a039ccc2841930ec59451..c447b785abe90c5ea25dd6cb49501d217f77b2b0 100644 (file)
@@ -50,9 +50,9 @@ TUPLE: no-math-method left right generic ;
 : math-vtable ( picker quot -- )
     [
         swap , \ tag ,
-        [ num-tags swap map % ] make-vector ,
+        [ num-tags swap map % ] { } make ,
         \ dispatch ,
-    ] make-list ; inline
+    ] [ ] make ; inline
 
 : math-class? ( object -- ? )
     dup word? [ "math-priority" word-prop ] [ drop f ] ifte ;
index d4503236c0d660eb31a7202ea5cd772884ee8b39..46e9d5cb1a7bf4259984db72ccea51500eb6c09b 100644 (file)
@@ -19,7 +19,7 @@ predicate [
     3dup nip "definition" set-word-prop
     pick predicate "metaclass" set-word-prop
     pick "superclass" word-prop "predicate" word-prop
-    [ \ dup , % , [ drop f ] , \ ifte , ] make-list
+    [ \ dup , % , [ drop f ] , \ ifte , ] [ ] make
     define-predicate ;
 
 PREDICATE: word predicate metaclass predicate = ;
index 2ae64e7faa8b772fd503c1a14c19f05675ee25a8..350d65093e3c7b3ee59637b3225570078b18d60f 100644 (file)
@@ -46,7 +46,7 @@ sequences strings vectors words ;
     >r word-name "-" r> append3 "in" get 2vector ;
 
 : writer-word ( class name -- word )
-    [ swap "set-" % word-name % "-" % % ] make-string
+    [ swap "set-" % word-name % "-" % % ] "" make
     "in" get 2vector ;
 
 : simple-slot ( class name -- reader writer )
index 535e3e7d6f84f395cca5ff76911f40dd3188bf7f..26d307698d39272c47ab126514d92ad6df3ea0bc 100644 (file)
@@ -3,13 +3,13 @@ USING: errors hashtables kernel kernel-internals lists math
 namespaces sequences vectors words ;
 
 : error-method ( picker word -- method )
-    [ swap % literalize , \ no-method , ] make-list ;
+    [ swap % literalize , \ no-method , ] [ ] make ;
 
 : empty-method ( picker word -- method )
     over [ dup ] = [
         [
             [ dup delegate ] % dup unit , error-method , \ ?ifte ,
-        ] make-list
+        ] [ ] make
     ] [
         error-method
     ] ifte ;
@@ -18,7 +18,7 @@ namespaces sequences vectors words ;
     [ uncons >r "predicate" word-prop append r> cons ] map-with ;
 
 : alist>quot ( default alist -- quot )
-    [ unswons [ % , , \ ifte , ] make-list ] each ;
+    [ unswons [ % , , \ ifte , ] [ ] make ] each ;
 
 : sort-methods ( assoc -- vtable )
     #! Input is a predicate -> method association.
@@ -36,7 +36,7 @@ namespaces sequences vectors words ;
     2dup methods class-predicates >r empty-method r> alist>quot ;
 
 : big-generic ( picker word -- def )
-    [ over % \ type , <vtable> , \ dispatch , ] make-list ;
+    [ over % \ type , <vtable> , \ dispatch , ] [ ] make ;
 
 : small-generic? ( word -- ? )
     "methods" word-prop hash-size 3 <= ;
index 8f2de62e04a843a67d68edfb5bc9c40a5eecf32d..c1ccee780dcbc18adf2412da2b61619223b20b0d 100644 (file)
@@ -22,7 +22,7 @@ namespaces parser sequences strings vectors words ;
     #! Make a foo? word for testing the tuple class at the top
     #! of the stack.
     dup predicate-word
-    [ \ class-tuple , over literalize , \ eq? , ] make-list
+    [ \ class-tuple , over literalize , \ eq? , ] [ ] make
     define-predicate ;
 
 : forget-tuple ( class -- )
@@ -53,13 +53,13 @@ namespaces parser sequences strings vectors words ;
 : define-constructor ( word class def -- )
     >r [
         dup literalize , "tuple-size" word-prop , \ make-tuple ,
-    ] make-list r> append define-compound ;
+    ] [ ] make r> append define-compound ;
 
 : default-constructor ( tuple -- )
     [ tuple-constructor ] keep dup [
         "slots" word-prop 1 swap tail-slice reverse-slice
         [ peek unit , \ keep , ] each
-    ] make-list define-constructor ;
+    ] [ ] make define-constructor ;
 
 : define-tuple ( tuple slots -- )
     2dup check-shape
index c156f8c29323c01a43de73ea76090f1958d977c7..160a0c1f78cd9f16fd20e16eba86bbb0f4eb793d 100644 (file)
@@ -40,7 +40,7 @@ SYMBOL: post-refresh-get?
 
 : get-random-id ( -- id ) 
   #! Generate a random id to use for continuation URL's
-  [ 32 [ 0 9 random-int CHAR: 0 + , ] times ] make-string
+  [ 32 [ 0 9 random-int CHAR: 0 + , ] times ] "" make
   string>number 36 >base ;
 
 #! Name of variable holding the table of continuations.
@@ -52,7 +52,7 @@ SYMBOL: table
     
 : reset-continuation-table ( -- ) 
   #! Create the initial global table
-  <namespace> table set ;
+  {{ }} clone table set ;
 
 #! Tuple for holding data related to a continuation.
 TUPLE: item expire? quot id time-added ;
@@ -202,7 +202,7 @@ SYMBOL: callback-cc
   [ 
     "HTTP/1.1 302 Document Moved\nLocation: " % %
     "\nContent-Length: 0\nContent-Type: text/plain\n\n" %
-  ] make-string call-exit-continuation ;
+  ] "" make call-exit-continuation ;
 
 : redirect-to-here ( -- )
   #! Force a redirect to the client browser so that the browser
@@ -275,7 +275,7 @@ SYMBOL: root-continuation
   #! Convert the given quotation so it works as a callback
   #! by returning a quotation that will pass the original 
   #! quotation to the callback continuation.
-  [ , callback-cc get , \ call , ] make-list ;
+  [ , callback-cc get , \ call , ] [ ] make ;
   
 : quot-href ( text quot -- )
   #! Write to standard output an HTML HREF where the href,
@@ -300,7 +300,7 @@ SYMBOL: root-continuation
   #!
   #! Convert the quotation so it is run within a session namespace
   #! and that namespace is initialized first.
-  \ init-session-namespace swons [ , \ with-scope , ] make-list
+  \ init-session-namespace swons [ , \ with-scope , ] [ ] make
   [ 
      [ cont-get/post-responder ] "get" set 
      [ cont-get/post-responder ] "post" set 
index ef7ad5b84797566b2efc457a62fb51b1cf46749a..5ae7f92205338627375e2bcb4153dd81e534fdb4 100644 (file)
@@ -8,7 +8,7 @@ test-responder ;
 #! Remove all existing responders, and create a blank
 #! responder table.
 global [
-    <namespace> responders set
+    {{ }} clone responders set
 
     ! Runs all unit tests and dumps result to the client. This uses
     ! a lot of server resources, so disable it on a busy server.
@@ -46,5 +46,5 @@ global [
     ! The root directory is served by...
     "file" set-default-responder
 
-    vhosts nest [ <namespace> "default" set ] bind
+    vhosts nest [ {{ }} clone "default" set ] bind
 ] bind
index 7aea901f5b6cd33e15fddbbaccd0217960dd2c88..04f3fc08ccb56c4a01f546c4b3a6e62b8cf3b8ad 100644 (file)
@@ -11,7 +11,7 @@ io strings ;
     [
         number>string "Content-Length" swons ,
         "Content-Type" swons ,
-    ] make-list "200 OK" response terpri ;
+    ] [ ] make "200 OK" response terpri ;
 
 : serve-static ( filename mime-type -- )
     over file-length file-response  "method" get "head" = [
index 24f6a38f0adec8d4671d12f352882fd3a2215fa9..7b6b76e3451a0ed5215dae37b798637387bd841e 100644 (file)
@@ -67,7 +67,7 @@ USE: sequences
 ! <a href= "http://" swap append a> "click" write </a>
 !
 ! (url -- )
-! <a href= [ "http://" % % ] make-string a> "click" write </a>
+! <a href= [ "http://" % % ] "" make a> "click" write </a>
 !
 ! Tags that have no 'closing' equivalent have a trailing tag/> form:
 !
@@ -78,7 +78,7 @@ USE: sequences
     #! suitable for embedding in an html tag.
     reverse [
         [ dup car % "='" % cdr % "'" % ] each
-    ] make-string ;
+    ] "" make ;
 
 : write-attributes ( n: namespace -- )    
     #! With the attribute namespace on the stack, get the attributes
@@ -106,7 +106,7 @@ USE: sequences
 ! : <p ( -- n: <namespace> )
 !     #! Used for setting inline attributes. Prints out
 !     #! an unclosed opening tag.
-!     "<p" write <namespace> >n ;
+!     "<p" write {{ }} clone >n ;
 !
 ! : p> ( n: <namespace> -- )
 !    #! Used to close off inline attribute version of word.
@@ -125,7 +125,7 @@ USE: sequences
 !
 ! : <input ( -- n: <namespace> )
 !     #! Used for setting inline attributes.
-!     "<input" write <namespace> >n ;
+!     "<input" write {{ }} clone >n ;
 !
 ! : input/> ( n: <namespace> -- )
 !     #! Used to close off inline attribute version of word
@@ -151,7 +151,7 @@ USE: sequences
 : def-for-html-word-<foo ( name -- name quot )
     #! Return the name and code for the <foo patterned
     #! word.
-    "<" swap append dup [ write <namespace> >n ] cons ;
+    "<" swap append dup [ write {{ }} clone >n ] cons ;
 
 : def-for-html-word-foo> ( name -- name quot )
     #! Return the name and code for the foo> patterned
@@ -163,13 +163,13 @@ USE: sequences
 : def-for-html-word-</foo> ( name -- name quot )
     #! Return the name and code for the </foo> patterned
     #! word.    
-    [ "</" % % ">" % ] make-string dup [ write ] cons ;
+    [ "</" % % ">" % ] "" make dup [ write ] cons ;
 
 : def-for-html-word-<foo/> ( name -- name quot )
     #! Return the name and code for the <foo/> patterned
     #! word.
-    [ "<" % dup % "/>" % ] make-string swap
-    [ "<" % % ">" % ] make-string
+    [ "<" % dup % "/>" % ] "" make swap
+    [ "<" % % ">" % ] "" make
     [ write ] cons ;
 
 : def-for-html-word-foo/> ( name -- name quot )
index e20c201c04e0ca544397b17f3d26d6e89236c857..93b630dc66e3b25a43a2e81fd4bb9d8ba498cfbc 100644 (file)
@@ -17,7 +17,7 @@ presentation sequences strings styles words ;
     #! Convert <, >, &, ' and " to HTML entities.
     [
         [ dup html-entities assoc [ % ] [ , ] ?ifte ] each
-    ] make-string ;
+    ] "" make ;
 
 : hex-color, ( triplet -- )
     [ >hex 2 CHAR: 0 pad-left % ] each ;
@@ -49,7 +49,7 @@ presentation sequences strings styles words ;
             [ font-size   size-css, ]
             [ underline   underline-css, ]
         ] assoc-apply
-    ] make-string ;
+    ] "" make ;
 
 : span-tag ( style quot -- )
     over css-style dup "" = [
@@ -66,7 +66,7 @@ presentation sequences strings styles words ;
     ] when* "/" ?tail drop ;
 
 : file-link-href ( path -- href )
-    [ "/" % resolve-file-link url-encode % ] make-string ;
+    [ "/" % resolve-file-link url-encode % ] "" make ;
 
 : file-link-tag ( style quot -- )
     over file swap assoc [
@@ -82,7 +82,7 @@ presentation sequences strings styles words ;
         url-encode %
         "&word=" %
         url-encode %
-    ] make-string ;
+    ] "" make ;
 
 : browser-link-tag ( style quot -- style )
     over presented swap assoc dup word? [
index 2c2a4d10bbda887f7bc9e08eef3fa5823d3d7003..0a93003e61ec4c4d4161a236a8ef819659f60d1b 100644 (file)
@@ -22,7 +22,7 @@ io strings ;
                 CHAR: % , >hex 2 CHAR: 0 pad-left %
             ] ifte
         ] each
-    ] make-string ;
+    ] "" make ;
 
 : catch-hex> ( str -- n )
     #! Push f if string is not a valid hex literal.
@@ -53,4 +53,4 @@ io strings ;
     ] ifte ;
 
 : url-decode ( str -- str )
-    [ 0 swap url-decode-iter ] make-string ;
+    [ 0 swap url-decode-iter ] "" make ;
index 20b44f37d971cb3f5924e212628fd8d1eb097fa5..6c8e01e365adf25db1322a9574249091c3387fd0 100644 (file)
@@ -49,7 +49,7 @@ SYMBOL: responders
     [
         "request" get % CHAR: / ,
         "raw-query" get [ CHAR: ? , % ] when*
-    ] make-string redirect ;
+    ] "" make redirect ;
 
 : query>alist ( query -- alist )
     dup [
@@ -66,7 +66,7 @@ SYMBOL: responders
 
 : log-user-agent ( alist -- )
     "User-Agent" swap assoc* [
-        unswons [ % ": " % % ] make-string log
+        unswons [ % ": " % % ] "" make log
     ] when* ;
 
 : prepare-url ( url -- url )
index 08c1e02e2a49f0b20f51075e6eae45e8d53727ae..7acf08930c6c59d5497e6af7d907ba12c82822dc 100644 (file)
@@ -150,8 +150,8 @@ DEFER: (infer-classes)
 
 : infer-classes ( node -- )
     [
-        <namespace> value-classes set
-        <namespace> value-literals set
-        <namespace> ties set
+        {{ }} clone value-classes set
+        {{ }} clone value-literals set
+        {{ }} clone ties set
         (infer-classes)
     ] with-scope ;
index 7790778a182a328b7719c2e450a2f749ccaafce4..d708abaae1509d10002d0e46ffa1c7ff0cc9c698 100644 (file)
@@ -53,7 +53,8 @@ M: node = eq? ;
 
 : make-node ( param in-d out-d in-r out-r node -- node )
     [
-        >r {{ }} {{ }} 10 <vector> f f <node> r> set-delegate
+        >r {{ }} clone {{ }} clone { } clone f f <node> r>
+        set-delegate
     ] keep ;
 
 : param-node ( label) { } { } { } { } ;
@@ -155,7 +156,7 @@ SYMBOL: current-node
     [
         dup node-in-d % dup node-out-d %
         dup node-in-r % node-out-r %
-    ] make-vector ;
+    ] { } make ;
 
 : uses-value? ( value node -- ? )
     node-values [ value-refers? ] contains-with? ;
@@ -220,7 +221,7 @@ DEFER: subst-value
 : subst-values ( new old node -- )
     #! Mutates the node.
     [
-        10 <vector> substituted set [
+        { } clone substituted set [
             3dup node-in-d  (subst-values)
             3dup node-in-r  (subst-values)
             3dup node-out-d (subst-values)
index 2214baaa5665fda8d77f4b75faec1bcd2335fbc8..489ae2d941a1aac5747251feb771cfb503a6abac 100644 (file)
@@ -65,7 +65,7 @@ SYMBOL: d-in
 
 : init-inference ( recursive-state -- )
     init-interpreter
-    0 <vector> d-in set
+    { } clone d-in set
     recursive-state set
     dataflow-graph off
     current-node off ;
index 521d0d6122c9de151f2a5716a806f1b96417d33e..53509c8f73f06da64b49e9bbda147fc63ec522dd 100644 (file)
@@ -7,7 +7,7 @@ matrices namespaces sequences vectors ;
 GENERIC: literals* ( node -- )
 
 : literals ( node -- seq )
-    [ [ literals* ] each-node ] make-vector ;
+    [ [ literals* ] each-node ] { } make ;
 
 GENERIC: can-kill* ( literal node -- ? )
 
index 808684456f653f3669f76683de5208bed509e951..daf33f0c7791ba2443925694d93a2bd84d94d8ba 100644 (file)
@@ -27,7 +27,7 @@ M: comment pprint* ( ann -- )
         2dup node-in-d value-str %
         "--" %
         node-out-d value-str %
-    ] make-string ;
+    ] "" make ;
 
 M: #push node>quot ( ? node -- )
     node-out-d [ literal-value literalize ] map % drop ;
@@ -77,7 +77,7 @@ M: #entry node>quot ( ? node -- ) "#entry" comment, ;
     ] ifte ;
 
 : dataflow>quot ( node ? -- quot )
-    [ swap (dataflow>quot) ] make-list ;
+    [ swap (dataflow>quot) ] [ ] make ;
 
 : dataflow. ( quot ? -- )
     #! Print dataflow IR for a quotation. Flag indicates if
index f596a217beadc099164e4c51b50ac7a1fccab027..aff97af702cb895befde647aea0e775537bc3311 100644 (file)
@@ -13,7 +13,7 @@ M: #call-label collect-recursion* ( label node -- )
 : collect-recursion ( label node -- seq )
     #! Collect the input stacks of all #call-label nodes that
     #! call given label.
-    [ [ collect-recursion* ] each-node-with ] make-vector ;
+    [ [ collect-recursion* ] each-node-with ] { } make ;
 
 GENERIC: solve-recursion*
 
index d4ed2494e25aaebdeb96989066a52efc43c685f8..a9dc5ef3af98482383a690bcbef83c54156faed0 100644 (file)
@@ -27,7 +27,7 @@ C: line-reader ( stream -- line ) [ set-delegate ] keep ;
     ] ifte ;
 
 M: line-reader stream-readln ( line -- string )
-    [ f swap (readln) ] make-string
+    [ f swap (readln) ] "" make
     dup empty? [ f ? ] [ nip ] ifte ;
 
 M: line-reader stream-read ( count line -- string )
@@ -46,4 +46,4 @@ M: line-reader stream-read ( count line -- string )
 
 : lines ( stream -- seq )
     #! Read all lines from the stream into a sequence.
-    [ 100 <vector> (lines) ] with-stream ;
+    [ { } clone (lines) ] with-stream ;
index 53c7c079046e0fd79911c60e3ffa976520d82b42..62abfa755d0e7add172022ea494c081950163680 100644 (file)
@@ -22,7 +22,7 @@ SYMBOL: log-stream
         dup client-stream-host %
         CHAR: : ,
         client-stream-port number>string % 
-    ] make-string log ;
+    ] "" make log ;
 
 : with-log-file ( file quot -- )
     #! Calls to log inside quot will output to a file.
index 3817ec7ffcb1404512f1667b77a10f530b534e1a..6c62969ce1e9025aa8bc4d9959af0e46ca803317 100644 (file)
@@ -15,7 +15,7 @@ sequences ;
 
 : modifiers, ( mod -- )
     modifiers get [
-        uncons pick bitand 0 = [ drop ] [ unique, ] ifte
+        uncons pick bitand 0 = [ drop ] [ , ] ifte
     ] each
     drop ;
 
@@ -31,4 +31,4 @@ sequences ;
     [
         dup keyboard-event-mod modifiers,
         keyboard-event-sym keysym,
-    ] make-list ;
+    ] [ ] make prune ;
index 9d39afd3de9540cede598b9c1231e27145b12464..87d0ef3123e6d9b2eabef968460eb901026c8b39 100644 (file)
@@ -64,7 +64,7 @@ GENERIC: number>string ( str -- num )
         ] [
             integer,
         ] ifte
-    ] make-rstring ;
+    ] "" make reverse ;
 
 : >bin ( num -- string ) 2 >base ;
 : >oct ( num -- string ) 8 >base ;
@@ -78,7 +78,7 @@ M: ratio number>string ( num -- str )
         numerator number>string %
         CHAR: / ,
         denominator number>string %
-    ] make-string ;
+    ] "" make ;
 
 : fix-float ( str -- str )
     #! This is terrible. Will go away when we do our own float
index 7b00564ab37a55aed63d73422af646cbf53a9eb5..a67a00eeef999cb8cf41613c7ff26c065dd506ff 100644 (file)
@@ -148,5 +148,5 @@ global [ string-mode off ] bind
     #! Read a string from the input stream, until it is
     #! terminated by a ".
     "col" [
-        [ "line" get (parse-string) ] make-string swap
+        [ "line" get (parse-string) ] "" make swap
     ] change ;
index 5137e4bfee137921ce09a53d3db2e5f4fbfbdd72..c4da50c4c5072f3dccb248eaacbd5a5db0390fa8 100644 (file)
@@ -219,7 +219,7 @@ M: complex pprint* ( num -- )
     ] when ;
 
 : pprint-string ( string prefix -- )
-    [ % [ unparse-ch ] each CHAR: " , ] make-string
+    [ % [ unparse-ch ] each CHAR: " , ] "" make
     do-string-limit f text ;
 
 M: string pprint* ( str -- str ) "\"" pprint-string ;
index 488338df9d45992da3fa1918f3da0ce650403a90..c084ddf87dac9c30d0f0d77afbed1c1b5193575e 100644 (file)
@@ -27,7 +27,7 @@ styles words ;
         dup first stack-picture%
         "-- " %
         second stack-picture%
-    ] make-string ;
+    ] "" make ;
 
 : stack-effect ( word -- string )
     dup "stack-effect" word-prop [ ] [
index c9c86e29d4816d48da19438ca1435b0b84db089e..dad011b070d48346abd299317167020cdc8a5d42 100644 (file)
@@ -4,7 +4,7 @@ USING: compiler kernel math namespaces sequences strings test ;
 
 : string-step ( n str -- )
     2dup length > [
-        dup [ "123" % % "456" % % "789" % ] make-string
+        dup [ "123" % % "456" % % "789" % ] "" make
         dup dup length 2 /i 0 swap rot subseq
         swap dup length 2 /i 1 + 1 swap rot subseq append
         string-step
diff --git a/library/test/gadgets/frames.factor b/library/test/gadgets/frames.factor
new file mode 100644 (file)
index 0000000..a767706
--- /dev/null
@@ -0,0 +1,56 @@
+IN: temporary
+USING: gadgets kernel namespaces test ;
+
+[ "Hello world" ]
+[
+    <frame> "frame" set
+    "Hello world" <label> 1 2 "frame" get set-frame-child
+    1 2 "frame" get frame-child label-text
+] unit-test
+
+[ { { 2 2 2 } { 3 3 3 } { 4 4 4 } } ] [
+    {
+        { { 0 0 0 } { 1 1 1 } { 2 2 2 } }
+        { { 0 0 0 } { 3 3 3 } { 0 0 0 } }
+        { { 0 0 0 } { 0 0 0 } { 4 4 4 } }
+    } reduce-grid
+] unit-test
+
+[ { 9 9 9 } ] [
+    {
+        { { 0 0 0 } { 1 1 1 } { 2 2 2 } }
+        { { 0 0 0 } { 3 3 3 } { 0 0 0 } }
+        { { 0 0 0 } { 0 0 0 } { 4 4 4 } }
+    } frame-pref-dim
+] unit-test
+
+[
+    {
+        { { 1 2 0 } { 2 2 0 } { 3 2 0 } }
+        { { 1 4 0 } { 2 4 0 } { 3 4 0 } }
+    }
+] [
+    { 1 2 3 } { 2 4 } frame-layout
+] unit-test
+
+: sized-gadget ( dim -- gadget )
+    <gadget> [ set-rect-dim ] keep ;
+
+[ { 90 120 0 } ]
+[
+    <frame> "frame" set
+    { 10 20 0 } sized-gadget 1 2 "frame" get set-frame-child
+    { 30 40 0 } sized-gadget 2 0 "frame" get set-frame-child
+    { 50 60 0 } sized-gadget 0 1 "frame" get set-frame-child
+    "frame" get pref-dim
+] unit-test
+
+[ { 140 250 0 } ]
+[
+    <frame> "frame" set
+    { 10 20 0 } sized-gadget 1 2 "frame" get set-frame-child
+    { 30 40 0 } sized-gadget 2 0 "frame" get set-frame-child
+    { 50 60 0 } sized-gadget 0 1 "frame" get set-frame-child
+    { 100 150 0 } sized-gadget 1 1 "frame" get set-frame-child
+    "frame" get pref-dim
+] unit-test
index 5a89a7c77aace9cb9b42bb5e7379f4060e52b3ca..144a76b5671b80131a2856576f0cbc3c0fd44734 100644 (file)
@@ -68,7 +68,7 @@ f 100000000000000000000000000 "testhash" get set-hash
 
 ! Testing the hash element counting
 
-<namespace> "counting" set
+{{ }} clone "counting" set
 "value" "key" "counting" get set-hash
 [ 1 ] [ "counting" get hash-size ] unit-test
 "value" "key" "counting" get set-hash
@@ -139,7 +139,7 @@ f 100000000000000000000000000 "testhash" get set-hash
     ] hash-each
 ] unit-test
 
-<namespace> "cache-test" set
+{{ }} clone "cache-test" set
 
 [ 4 ] [ 1 "cache-test" get [ 3 + ] cache ] unit-test
 [ 5 ] [ 2 "cache-test" get [ 3 + ] cache ] unit-test
index 20a4ca3d71696d818c73bbf22057a0ccd46d32fe..f16a1aacb06b6f2eb45b4496750095ef484ddf7a 100644 (file)
@@ -37,5 +37,5 @@ USE: sequences
     [ "xyz" , "xyz" unique,
     #{ 3 2 }# , #{ 3 2 }# unique,
     1/5 , 1/5 unique,
-    [ { } unique, ] make-list , ] make-list
+    [ { } unique, ] [ ] make , ] [ ] make
 ] unit-test
index 5530cbc6d1cb346c7ceeb0720ffd4950da873710..0e226eb4c06e7ab78da0d4c6a141425d95d71f3c 100644 (file)
@@ -9,5 +9,5 @@ USE: namespaces
 [ ] [ -1 [ ] times ] unit-test
 
 [ ] [ 5 [ ] repeat ] unit-test
-[ [ 0 1 2 3 4 ] ] [ [ 5 [ dup , ] repeat ] make-list ] unit-test
-[ [ ] ] [ [ -1 [ dup , ] repeat ] make-list ] unit-test
+[ [ 0 1 2 3 4 ] ] [ [ 5 [ dup , ] repeat ] [ ] make ] unit-test
+[ [ ] ] [ [ -1 [ dup , ] repeat ] [ ] make ] unit-test
index 055f9f618129537a6e27afec14a2d206379f541d..0592835233d625bc1d3c9c696d96932dd2c9b590 100644 (file)
@@ -4,10 +4,10 @@ USE: namespaces
 USE: test
 USE: words
 
-<namespace> "test-namespace" set
+{{ }} clone "test-namespace" set
 
 : test-namespace ( -- )
-    <namespace> dup [ namespace = ] bind ;
+    {{ }} clone dup [ namespace = ] bind ;
 
 [ t ] [ test-namespace ] unit-test
 
@@ -21,5 +21,5 @@ USE: words
 
 10 "some-global" set
 [ f ]
-[ <namespace> [ f "some-global" set "some-global" get ] bind ]
+[ {{ }} clone [ f "some-global" set "some-global" get ] bind ]
 unit-test
index b6f0c0d2ce3376c8944222ded3e52825fd6ba3eb..80eb79c6069f41198d3c90d156d3f33b75d3039a 100644 (file)
@@ -8,7 +8,6 @@ test vectors ;
 [ 2 ] [ 1 3 { 1 2 3 4 } <slice> length ] unit-test
 [ { 2 3 } ] [ 1 3 { 1 2 3 4 } <slice> >vector ] unit-test
 [ { 4 5 } ] [ 2 { 1 2 3 4 5 } tail-slice* >vector ] unit-test
-[ { 1 2 } { 3 4 } ] [ 2 { 1 2 3 4 } cut ] unit-test
 [ { 3 4 } ] [ 2 4 1 10 <range> subseq >vector ] unit-test
 [ { 3 4 } ] [ 0 2 2 4 1 10 <range> <slice> subseq >vector ] unit-test
 [ "cba" ] [ 3 "abcdef" head-slice reverse ] unit-test
index ebca6ae11d236bd0229d2e5f0144fb5df28792c5..de36d62a931014143fe2983c804f75753388b222 100644 (file)
@@ -11,7 +11,7 @@ USE: lists
 
 [ ] [ 10 [ [ -1000000 <sbuf> ] [ drop ] catch ] times ] unit-test
 
-[ "abc" ] [ [ "a" "b" "c" ] [ [ % ] each ] make-string ] unit-test
+[ "abc" ] [ [ "a" "b" "c" ] [ [ % ] each ] "" make ] unit-test
 
 [ "abc" ] [ "ab" "c" append ] unit-test
 [ "abc" ] [ "a" "b" "c" append3 ] unit-test
@@ -33,10 +33,6 @@ USE: lists
 
 [ "end" ] [ 14 "Beginning and end" tail ] unit-test
 
-[ "" 10 cut ] unit-test-fails
-
-[ "Beginning" " and end" ] [ 9 "Beginning and end" cut ] unit-test
-
 [ "hello" "world" ] [ "hello world" " " split1 ] unit-test
 [ "goodbye" f ] [ "goodbye" " " split1 ] unit-test
 [ "" "" ] [ "great" "great" split1 ] unit-test
index 711305e8645e88631fc2a396626fefe438688fc0..9d6c571bbb698c14db3e4ff55d436769cd30fcc1 100644 (file)
@@ -24,7 +24,7 @@ M: assert error.
     [
         number>string % " ms run / " %
         number>string % " ms GC time" %
-    ] make-string print ;
+    ] "" make print ;
 
 : unit-test ( output input -- )
     [
@@ -89,7 +89,7 @@ SYMBOL: failures
         "httpd/http-client" "sbuf" "threads" "parsing-word"
         "inference" "interpreter" "alien"
         "gadgets/line-editor" "gadgets/rectangles"
-        "gadgets/gradients" "memory"
+        "gadgets/gradients" "gadgets/frames" "memory"
         "redefine" "annotate" "sequences" "binary" "inspector"
         "kernel"
     } run-tests ;
index a56ac5955d2a5b126c131fb004c338d3d7bc1e82..ac5b0b2144df54746a378f1758e01784442f3f13 100644 (file)
@@ -84,6 +84,6 @@ GENERIC: tick ( ms object -- )
 : init-threads ( -- )
     global [
         <queue> \ run-queue set
-        10 <vector> \ sleep-queue set
-        <namespace> \ timers set
+        { } clone \ sleep-queue set
+        {{ }} clone \ timers set
     ] bind ;
index 1d3599705ef6fee7bc8e78ecd13420eb32f0434b..cd44e2a8f61274ca2d504b84ed89f838811d5cb6 100644 (file)
@@ -18,7 +18,7 @@ sequences strings test ;
         %
         "===> Leaving:  " swap word-name append ,
         [ print .s ] %
-    ] make-list ;
+    ] [ ] make ;
 
 : watch ( word -- )
     #! Cause a message to be printed out when the word is
@@ -36,7 +36,7 @@ sequences strings test ;
     inline
 
 : (profile) ( word def -- def )
-    [ , literalize , \ with-profile , ] make-list ;
+    [ , literalize , \ with-profile , ] [ ] make ;
 
 : profile ( word -- )
     #! When the word is called, time it, and add the time to
index 195b51c41658a7e174499b5e47bcebfa22de96da..ee1019cbeeb8d1804d676d4774452377d72122b8 100644 (file)
@@ -95,7 +95,7 @@ SYMBOL: inspector-stack
         inspector-help
         terpri
         "inspector " listener-prompt set
-        10 <vector> inspector-stack set
+        { } clone inspector-stack set
         (inspect)
         listener
     ] with-scope ;
index 6c1930af0afbe4fbdf6015887a1d2842b6d369b3..70de964113d564de3d30b7f0aec25d709b9d76f6 100644 (file)
@@ -24,8 +24,8 @@ SYMBOL: meta-cf
 SYMBOL: meta-executing
 
 : init-interpreter ( -- )
-    10 <vector> meta-r set
-    10 <vector> meta-d set
+    { } clone meta-r set
+    { } clone meta-d set
     namestack meta-n set
     catchstack meta-c set
     f meta-cf set
index aa10da4076db63774262ba7e476c0dc49729b2cd..c4cfad16aea328c4d39e7d4b1b900f9bc39f103d 100644 (file)
@@ -57,7 +57,7 @@ unparser vectors words ;
         [
             [ swap call ] 2keep rot [ , ] [ drop ] ifte
         ] each-object drop
-    ] make-list ;
+    ] [ ] make ;
 
 G: each-slot ( obj quot -- )
     [ over ] standard-combination ; inline
index 037a6628f00b2a0c547182a83e87b60641cf3c00..66f368efc9fc4441eae96b6144ccd0fa3105f576 100644 (file)
@@ -21,7 +21,7 @@ styles vectors ;
     }} hash ;
 
 : ttf-path ( name -- string )
-    [ resource-path % "/fonts/" % % ".ttf" % ] make-string ;
+    [ resource-path % "/fonts/" % % ".ttf" % ] "" make ;
 
 : open-font ( [ font style ptsize ] -- alien )
     3unseq >r ttf-name ttf-path r> TTF_OpenFont ;
index e276b3bcf920655ad057bca3938634be2457087e..12b0386292095b14ec0193478b65a7fcc177ec1f 100644 (file)
 ! Copyright (C) 2005 Slava Pestov.
 ! See http://factor.sf.net/license.txt for BSD license.
 IN: gadgets
-USING: gadgets generic kernel lists math namespaces sdl
-sequences vectors words ;
+USING: generic kernel lists math namespaces sequences vectors ;
 
-SYMBOL: x
-SYMBOL: y
+! A frame arranges gadgets in a 3x3 grid, where the center
+! gadgets gets left-over space.
+TUPLE: frame grid ;
 
-! A frame arranges left/right/top/bottom gadgets around a
-! center gadget, which gets any leftover space.
-TUPLE: frame left right top bottom center ;
-
-: add-center ( gadget frame -- )
-    dup frame-center unparent 2dup set-frame-center add-gadget ;
-: add-left ( gadget frame -- )
-    dup frame-left unparent 2dup set-frame-left add-gadget ;
-: add-right ( gadget frame -- )
-    dup frame-right unparent 2dup set-frame-right add-gadget ;
-: add-top ( gadget frame -- )
-    dup frame-top unparent 2dup set-frame-top add-gadget ;
-: add-bottom ( gadget frame -- )
-    dup frame-bottom unparent 2dup set-frame-bottom add-gadget ;
+: <frame-grid> { { f f f } { f f f } { f f f } } [ clone ] map ;
 
 C: frame ( -- frame )
-    [ <gadget> swap set-delegate ] keep
-    [ <gadget> swap set-frame-center ] keep
-    [ <gadget> swap set-frame-left ] keep
-    [ <gadget> swap set-frame-right ] keep
-    [ <gadget> swap set-frame-top ] keep
-    [ <gadget> swap set-frame-bottom ] keep ;
-
-: frame-major ( frame -- list )
-    [
-        dup frame-top , dup frame-center , frame-bottom ,
-    ] make-list ;
-
-: frame-minor ( frame -- list )
-    [
-        dup frame-left , dup frame-center , frame-right ,
-    ] make-list ;
-
-: pref-size pref-dim 3unseq drop ;
-
-: max-h pref-size nip height [ max ] change ;
-: max-w pref-size drop width [ max ] change ;
-
-: add-h pref-size nip height [ + ] change ;
-: add-w pref-size drop width [ + ] change ;
-
-: with-pref-size ( quot -- )
-    [
-        0 width set 0 height set call width get height get
-    ] with-scope ; inline
-
-M: frame pref-dim ( glue -- dim )
-    [
-        dup frame-major [ max-w ] each
-        dup frame-minor [ max-h ] each
-        dup frame-left add-w
-        dup frame-right add-w
-        dup frame-top add-h
-        frame-bottom add-h
-    ] with-pref-size 0 3vector ;
+    <gadget> over set-delegate <frame-grid> over set-frame-grid ;
 
-SYMBOL: frame-right-run
-SYMBOL: frame-bottom-run
+: frame-child ( frame i j -- gadget ) rot frame-grid nth nth ;
 
-: var-frame-x [ execute pref-size drop ] keep set ; inline
-: var-frame-y [ execute pref-size nip ] keep set ; inline
-: var-frame-left \ frame-left var-frame-x ;
-: var-frame-top \ frame-top var-frame-y ;
-: var-frame-right
-    dup \ frame-right var-frame-x
-    swap rect-dim first \ frame-right [ - ] change
-    \ frame-right get \ frame-left get - frame-right-run set ;
-: var-frame-bottom
-    dup \ frame-bottom var-frame-y
-    swap rect-dim second \ frame-bottom [ - ] change
-    \ frame-bottom get \ frame-top get - frame-bottom-run set ;
+: set-frame-child ( gadget frame i j -- )
+    3dup frame-child unparent
+    >r >r 2dup add-gadget r> r>
+    rot frame-grid nth set-nth ;
 
-: setup-frame ( frame -- )
-    dup var-frame-left
-    dup var-frame-top
-    dup var-frame-right
-    var-frame-bottom ;
+: add-center ( gadget frame -- ) 1 1 set-frame-child ;
+: add-left   ( gadget frame -- ) 0 1 set-frame-child ;
+: add-right  ( gadget frame -- ) 2 1 set-frame-child ;
+: add-top    ( gadget frame -- ) 1 0 set-frame-child ;
+: add-bottom ( gadget frame -- ) 1 2 set-frame-child ;
 
-: move-gadget ( x y gadget -- )
-    >r 0 3vector r> set-rect-loc ;
+: reduce-grid ( grid -- seq )
+    [ { 0 0 0 } [ vmax ] reduce ] map ;
 
-: reshape-gadget ( x y w h gadget -- )
-    [ >r 0 3vector r> set-gadget-dim ] keep move-gadget ;
+: frame-pref-dim ( grid -- dim )
+    reduce-grid { 0 0 0 } [ v+ ] reduce ;
 
-: pos-frame-center
-    >r \ frame-left get \ frame-top get
-    \ frame-right-run get \ frame-bottom-run get r>
-    reshape-gadget ;
+: pref-dim-grid ( grid -- grid )
+    [ [ [ pref-dim ] [ { 0 0 0 } ] ifte* ] map ] map ;
 
-: pos-frame-left
-    [
-        >r 0 \ frame-top get r> pref-size drop \ frame-bottom-run get
-    ] keep reshape-gadget ;
+M: frame pref-dim ( frame -- dim )
+    frame-grid pref-dim-grid
+    dup frame-pref-dim first
+    swap flip frame-pref-dim second
+    0 3vector ;
 
-: pos-frame-right
-    [
-        >r \ frame-right get \ frame-top get r> pref-size drop
-        \ frame-bottom-run get
-    ] keep reshape-gadget ;
+: frame-layout ( horiz vert -- grid )
+    [ swap [ swap 0 3vector ] map-with ] map-with ;
 
-: pos-frame-top
-    [
-        >r \ frame-left get 0 \ frame-right get r> pref-size nip
-    ] keep reshape-gadget ;
+: do-grid ( dim-grid gadget-grid quot -- )
+    -rot [ [ pick call ] 2each ] 2each drop ;
 
-: pos-frame-bottom
-    [
-        >r \ frame-left get \ frame-bottom get \ frame-right get
-        r> pref-size nip
-    ] keep reshape-gadget ;
+: position-grid ( gadgets horiz vert -- )
+    >r 0 [ + ] accumulate r> 0 [ + ] accumulate
+    frame-layout swap [ set-rect-loc ] do-grid ;
 
-: layout-frame ( frame -- )
-    dup frame-center pos-frame-center
-    dup frame-left pos-frame-left
-    dup frame-right pos-frame-right
-    dup frame-top pos-frame-top
-    frame-bottom pos-frame-bottom ;
+: resize-grid ( gadgets horiz vert -- )
+    frame-layout swap [ set-gadget-dim ] do-grid ;
 
-M: frame layout* ( frame -- )
-    [ 0 x set 0 y set dup setup-frame layout-frame ] with-scope ;
+M: frame layout* ( frame -- dim )
+    frame-grid dup pref-dim-grid
+    dup reduce-grid [ first ] map
+    swap flip reduce-grid [ second ] map
+    3dup position-grid resize-grid ;
index 44f9dc255c276c82542bd07b6c4eb52e531ddf89..406695d35d9144ae61d640b41ac9453293b7cd8d 100644 (file)
@@ -35,6 +35,8 @@ TUPLE: gadget
     paint gestures visible? relayout? root?
     parent children ;
 
+M: gadget = eq? ;
+
 : gadget-child gadget-children first ;
 
 C: gadget ( -- gadget )
index 538ee754ee3a337528a114755c4007ce828d9839..4b034c36cd3bc835f1a4c5f50a7002b3c389d98e 100644 (file)
@@ -5,7 +5,7 @@ USING: generic hashtables kernel lists math matrices namespaces
 sequences vectors ;
 
 : remove-gadget ( gadget parent -- )
-    [ 2dup gadget-children remq swap set-gadget-children ] keep
+    [ 2dup gadget-children remove swap set-gadget-children ] keep
     relayout f swap set-gadget-parent ;
 
 : unparent ( gadget -- )
index 4979b6e3b2566eb9eb40c9188dc4c283af4c9287..6d3317cf72145d8658cd2e963f1fd3d71f962110 100644 (file)
@@ -63,7 +63,7 @@ SYMBOL: history-index
 : <line-editor> ( -- editor )
     [
         line-clear
-        100 <vector> history set
+        { } clone history set
         0 history-index set
     ] make-hash ;
 
@@ -79,7 +79,7 @@ SYMBOL: history-index
     #! Call this in the line editor scope.
     reset-history
     2dup caret-insert
-    line-text get cut
+    line-text get [ head ] 2keep tail
     swapd append3 line-text set ;
 
 : insert-char ( ch -- )
index a937f248f5a3db4729f2185bf04c2ef79f139553..810a5ad2f1aa72df0cbd18292154895b51ccd5e6 100644 (file)
@@ -6,7 +6,7 @@ namespaces parser prettyprint sequences styles vectors words ;
 
 SYMBOL: commands
 
-global [ 100 <vector> commands set ] bind
+{ } clone commands global set-hash
 
 : define-command ( class name quot -- )
     3vector commands get push ;
@@ -15,7 +15,7 @@ global [ 100 <vector> commands set ] bind
     commands get [ first call ] subset-with ;
 
 : command-quot ( presented quot -- quot )
-    [ swap literalize , % ] make-list
+    [ swap literalize , % ] [ ] make
     [ pane get pane-call drop ] cons ;
 
 : command-menu ( presented -- menu )
@@ -29,7 +29,7 @@ global [ 100 <vector> commands set ] bind
             \ drop ,
             literalize ,
             [ command-menu show-menu ] %
-        ] make-list
+        ] [ ] make
         button-gestures
     ] [
         2drop
index 46aa1d062ac5db7bda600623935e2788091e4af7..b2257da6072fe279efbe724aae85383333ba3149 100644 (file)
@@ -53,7 +53,7 @@ C: splitter ( first second split vector -- splitter )
         dup splitter-part ,
         divider-size ,
         dup rect-dim divider-size v- swap splitter-part v- ,
-    ] make-vector ;
+    ] { } make ;
 
 M: splitter layout* ( splitter -- )
     dup splitter-layout packed-layout ;
index 8cb3974ed2c65270e9bbd36de660163e6e371641..fd40ea8fdc2501b43b403a0389c22f34aabda85b 100644 (file)
@@ -44,9 +44,9 @@ SYMBOL: stack-display
                 listener
             ] with-stream
         ] in-thread
+    ] bind
         
-        pane get request-focus
-    ] bind ;
+        pane get request-focus ;
 
 SYMBOL: first-time
 
index add19d9f9dcf76ec8992a10a1293428aa3222fe9..ac330735d90f71f280a2e1d4282b0578bbb01e54 100644 (file)
@@ -81,7 +81,7 @@ M: port set-timeout ( timeout port -- )
         "Error on fd " %
         dup port-handle number>string %
         ": " % swap %
-    ] make-string swap set-port-error ;
+    ] "" make swap set-port-error ;
 
 : defer-error ( port -- ? )
     #! Return t if it is an unrecoverable error.
@@ -306,9 +306,9 @@ USE: io
     #! Should only be called on startup. Calling this at any
     #! other time can have unintended consequences.
     global [
-        <namespace> read-tasks set
+        {{ }} clone read-tasks set
         FD_SETSIZE <bit-array> read-fdset set
-        <namespace> write-tasks set
+        {{ }} clone write-tasks set
         FD_SETSIZE <bit-array> write-fdset set
         0 1 t <fd-stream> stdio set
     ] bind ;
index 00c83ad5acfd5353d828b99ce27d079d0d6639cd..e6a41b3d71c49b070d80f7dc0058219e194da60a 100644 (file)
@@ -85,7 +85,7 @@ C: accept-task ( port -- task )
         dup -16 shift HEX: ff bitand number>string % CHAR: . ,
         dup -8  shift HEX: ff bitand number>string % CHAR: . ,
                       HEX: ff bitand number>string %
-    ] make-string ;
+    ] "" make ;
 
 : do-accept ( port sockaddr fd -- )
     [
index 9e701c78bb3d35a0361a0596e1ea129dce510573..9378f567fd519499bbd2822454668ffd59ef5281 100644 (file)
@@ -6,8 +6,8 @@ sequences ;
 
 SYMBOL: vocabularies
 
-: word ( -- word ) "last-word" global hash ;
-: set-word ( word -- ) "last-word" global set-hash ;
+: word ( -- word ) \ word global hash ;
+: set-word ( word -- ) \ word global set-hash ;
 
 : vocabs ( -- list )
     #! Push a list of vocabularies.
@@ -31,14 +31,14 @@ SYMBOL: vocabularies
 
 : word-subset ( pred -- list | pred: word -- ? )
     #! A list of words matching the predicate.
-    all-words swap subset word-sort ; inline
+    all-words swap subset ; inline
 
 : word-subset-with ( obj pred -- list | pred: obj word -- ? )
-    all-words swap subset-with word-sort ; inline
+    all-words swap subset-with ; inline
 
 : recrossref ( -- )
     #! Update word cross referencing information.
-    global [ <namespace> crossref set ] bind
+    {{ }} clone crossref global set-hash
     [ add-crossref ] each-word ;
 
 : lookup ( name vocab -- word ) vocab ?hash ;
@@ -76,11 +76,11 @@ SYMBOL: vocabularies
 : forget ( word -- )
     #! Remove a word definition.
     dup uncrossref
-    dup word-vocabulary vocab [ word-name off ] bind ;
+    dup word-name swap word-vocabulary vocab remove-hash ;
 
 : interned? ( word -- ? )
     #! Test if the word is a member of its vocabulary.
-    dup word-name over word-vocabulary vocab ?hash eq? ;
+    dup word-name over word-vocabulary lookup eq? ;
 
 : init-search-path ( -- )
     "scratchpad" "in" set
index 70088b50bea2abf15ecada240a5166191e31d64a..26921e0e54dc22fe35a3ba8d1bab0917f9b4108f 100644 (file)
@@ -80,7 +80,7 @@ END-STRUCT
     "overlapped-ext" c-size malloc <alien> ;
 
 C: io-queue ( -- queue )
-    0 <vector> over set-io-queue-callbacks ;
+    { } clone over set-io-queue-callbacks ;
 
 C: io-callback ( -- callback )
     io-queue get io-queue-callbacks [ push ] 2keep