]> gitweb.factorcode.org Git - factor.git/commitdiff
fix stage1 bootstrap, minor handbook update
authorSlava Pestov <slava@factorcode.org>
Thu, 19 May 2005 19:16:25 +0000 (19:16 +0000)
committerSlava Pestov <slava@factorcode.org>
Thu, 19 May 2005 19:16:25 +0000 (19:16 +0000)
CHANGES.txt
TODO.FACTOR.txt
doc/handbook.tex
library/bootstrap/boot-stage1.factor
library/collections/sbuf.factor
library/collections/sequences-epilogue.factor
library/collections/strings-epilogue.factor
library/math/matrices.factor
library/syntax/prettyprint.factor
library/test/strings.factor
library/tools/debugger.factor

index 4c3ec2caeea3c6955c3554b0e64a79321e3cabf2..ef75bc65a19b91ce45a4323341c018f5dc99403b 100644 (file)
@@ -48,11 +48,17 @@ string-head   head
 string-head?  head?
 ?string-head  ?head
 string-tail   tail
+vector-tail   tail
+vector-tail*  tail*
 string-tail?  tail?
 ?string-tail  ?tail
 substring     subseq
 cat2          append
 cat3          append3
+string/       cut
+string//      cut*
+split1        split1
+split         split
 
 Factor 0.74:
 ------------
index b1696cec1637ef4c46d21d5e9fd3c382654fda0f..a6d5ed4be1c32a4458b8d8d2138779dea60eb032 100644 (file)
@@ -21,7 +21,6 @@
 - virtual hosts\r
 - keep alive\r
 - sleep word\r
-- update docs\r
 - redo new compiler backend for PowerPC\r
 \r
 - plugin: supportsBackspace\r
@@ -36,7 +35,6 @@
 - faster sequence operations\r
 - generic some? all? memq? all=?\r
 - index and index* are very slow with lists\r
-- unsafe-sbuf>string\r
 - code walker & exceptions\r
 - if two tasks write to a unix stream, the buffer can overflow\r
 - rename prettyprint to pprint\r
index 54a689d365d59fe49031b7f64d5adcd33a1f35b1..aced70bc3744eb2896a9777144be4228c494334c 100644 (file)
@@ -812,6 +812,9 @@ description=the currently executing quotation}}
 \glossary{
 name=interpreter,
 description=executes quotations by iterating them and recursing into nested definitions. see compiler}
+\glossary{
+name=quotation,
+description=a list containing Factor code to be executed}
 
 The Factor interpreter executes quotations. Quotations are lists, and since lists can contain any Factor object, they can contain words. It is words that give quotations their operational behavior, as you can see in the following description of the interpreter algorithm.
 
index cdf04d74df6054c9007acbc5ab7cb0b98d617b36..b24007fd894af734dfcc8dcb918829e28eb555cb 100644 (file)
@@ -33,8 +33,8 @@ hashtables sequences ;
         "/library/collections/sequences-epilogue.factor"
         "/library/collections/hashtables.factor"
         "/library/collections/namespaces.factor"
-        "/library/collections/slicing.factor"
         "/library/collections/vectors-epilogue.factor"
+        "/library/collections/slicing.factor"
         "/library/collections/strings-epilogue.factor"
         "/library/math/matrices.factor"
         "/library/words.factor"
index d0f2f30c31e1f04212fdda8a11e73ac6188fe0d1..30d998db6cb99690e49b5227b8b6066fb46f19d3 100644 (file)
@@ -1,8 +1,12 @@
 ! Copyright (C) 2004, 2005 Slava Pestov.
 ! See http://factor.sf.net/license.txt for BSD license.
+IN: kernel-internals
+USING: kernel math strings ;
+
+: (sbuf>string) underlying dup rehash-string ;
+
 IN: strings
-USING: generic kernel kernel-internals math math-internals
-sequences ;
+USING: generic sequences ;
 
 M: string (grow) grow-string ;
 
index 1c2847ca873e7c81b1d528564e711349289e805c..ea280ea40b650355346119346b35949dfb317ad9 100644 (file)
@@ -167,6 +167,11 @@ M: sequence = ( obj seq -- ? )
         ] ifte
     ] ifte ;
 
+! A repeated sequence is the same element n times.
+TUPLE: repeated length object ;
+M: repeated length repeated-length ;
+M: repeated nth nip repeated-object ;
+
 IN: kernel
 
 : depth ( -- n )
index caf3a3b01975d30dde0cfd5e6d98c926072d218b..25cc8539b919185cdfc9eae75cea7c2db590c22d 100644 (file)
@@ -16,11 +16,11 @@ sequences strings ;
         r> fill swap append
     ] ifte ;
 
-: ch>string ( ch -- str ) 1 <sbuf> [ push ] keep >string ;
+: ch>string ( ch -- str ) 1 <sbuf> [ push ] keep (sbuf>string) ;
 
 : >sbuf ( seq -- sbuf ) dup length <sbuf> [ swap nappend ] keep ;
 
-M: object >string >sbuf underlying dup rehash-string ;
+M: object >string >sbuf (sbuf>string) ;
 
 M: string thaw >sbuf ;
 M: string freeze drop >string ;
index b7a2a6044d713578c5617e43e1a7eca9ef771f15..bd2b2cba8e3630732d9ea18b5605a6e45641342f 100644 (file)
@@ -12,11 +12,11 @@ vectors ;
 : v+ ( v v -- v ) [ + ] 2map ;
 : v- ( v v -- v ) [ - ] 2map ;
 : v* ( v v -- v ) [ * ] 2map ;
+: v** ( v v -- v ) [ conjugate * ] 2map ;
 
-! Later, this will fixed when seq-2each works properly
-! : v. ( v v -- x ) 0 swap [ * + ] seq-2each ;
-: +/ ( seq -- n ) 0 swap [ + ] each ;
-: v. ( v v -- x ) v* +/ ;
+! Later, this will fixed when 2each works properly
+! : v. ( v v -- x ) 0 swap [ * + ] 2each ;
+: v. ( v v -- x ) v** 0 swap [ + ] each ;
 
 ! Matrices
 ! The major dimension is the number of elements per row.
index f5e8195bf4743295c550d184bcf2bf274c810f80..f094cca2f98be6acdd122a5449b3593f8d6941cc 100644 (file)
@@ -163,9 +163,9 @@ M: alien prettyprint* ( alien -- str )
     [ over ?prettyprint-newline matrix-rows. ] when* ;
 
 M: matrix prettyprint* ( indent obj -- indent )
-    \ M[ word. >r <prettyprint r>
+    \ M[ word. bl >r 3 + r>
     row-list matrix-rows.
-    bl \ ]M word. prettyprint> ;
+    bl \ ]M word. 3 - ;
 
 : prettyprint ( obj -- )
     [
index de4d9a4bb4be5249ed9e81fa6ee5924665992d12..3a04d0a31d851cdd0798375e17628ef7f7a4d769 100644 (file)
@@ -13,14 +13,14 @@ USE: lists
 [ "abc" ] [ "ab" "c" append ] unit-test
 [ "abc" ] [ "a" "b" "c" append3 ] unit-test
 
-[ 3 ] [ "a" "hola" seq-index ] unit-test
-[ -1 ] [ "x" "hola" seq-index ] unit-test
-[ 0 ] [ "" "a" seq-index ] unit-test
-[ 0 ] [ "" "" seq-index ] unit-test
-[ 0 ] [ "hola" "hola" seq-index ] unit-test
-[ 1 ] [ "ol" "hola" seq-index ] unit-test
-[ -1 ] [ "amigo" "hola" seq-index ] unit-test
-[ -1 ] [ "holaa" "hola" seq-index ] unit-test
+[ 3 ] [ "a" "hola" start ] unit-test
+[ -1 ] [ "x" "hola" start ] unit-test
+[ 0 ] [ "" "a" start ] unit-test
+[ 0 ] [ "" "" start ] unit-test
+[ 0 ] [ "hola" "hola" start ] unit-test
+[ 1 ] [ "ol" "hola" start ] unit-test
+[ -1 ] [ "amigo" "hola" start ] unit-test
+[ -1 ] [ "holaa" "hola" start ] unit-test
 
 [ "Beginning" ] [ 9 "Beginning and end" head ] unit-test
 
@@ -76,7 +76,7 @@ unit-test
 
 [ f ] [ [ 0 10 "hello" subseq ] [ not ] catch ] unit-test
 
-[ [ "hell" "o wo" "rld" ] ] [ 4 "hello world" split-n ] unit-test
+[ [ "hell" "o wo" "rld" ] ] [ 4 "hello world" groups ] unit-test
 
 [ 4 ] [
     0 "There are Four Upper Case characters"
index 1d08df5bac2e617194f14a0128634ddd4d9c23ce..9174b933a956a832ce9b4e23827ff7017ea4a172 100644 (file)
@@ -73,15 +73,14 @@ M: no-method error. ( error -- )
     ] make-string print ;
 
 : parse-dump ( error -- )
-    [
-        "Parsing " %
-        dup parse-error-file [ "<interactive>" ] unless* % ":" %
-        dup parse-error-line [ 1 ] unless* unparse ,
-    ] make-string print
+    "Parsing " write
+    dup parse-error-file [ "<interactive>" ] unless* write
+    ":" write
+    dup parse-error-line [ 1 ] unless* unparse print
     
     dup parse-error-text dup string? [ print ] [ drop ] ifte
     
-    [ parse-error-col CHAR: \s fill % "^" % ] make-string print ;
+    parse-error-col CHAR: \s fill write "^" print ;
 
 M: parse-error error. ( error -- )
     dup parse-dump  delegate error. ;