fix stage1 bootstrap, minor handbook update
parent
4e36ff5f72
commit
c821addef0
|
@ -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:
|
||||
------------
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
- virtual hosts
|
||||
- keep alive
|
||||
- sleep word
|
||||
- update docs
|
||||
- redo new compiler backend for PowerPC
|
||||
|
||||
- plugin: supportsBackspace
|
||||
|
@ -36,7 +35,6 @@
|
|||
- faster sequence operations
|
||||
- generic some? all? memq? all=?
|
||||
- index and index* are very slow with lists
|
||||
- unsafe-sbuf>string
|
||||
- code walker & exceptions
|
||||
- if two tasks write to a unix stream, the buffer can overflow
|
||||
- rename prettyprint to pprint
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 ;
|
||||
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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 ;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 -- )
|
||||
[
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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. ;
|
||||
|
|
Loading…
Reference in New Issue