Fix ltrim/rtrim, get extra/ to load after number tower changes

release
Slava Pestov 2007-10-21 17:37:50 -04:00
parent 024cf03a1b
commit de0808320e
24 changed files with 71 additions and 42 deletions

View File

@ -19,7 +19,7 @@ IN: bootstrap.stage2
parse-command-line
H{ } clone changed-words set-global
all-words [ dup ] H{ } map>assoc changed-words set-global
"-no-crossref" cli-args member? [
"Cross-referencing..." print flush
@ -41,9 +41,6 @@ IN: bootstrap.stage2
] if
[
! Compile everything if compiler is loaded
all-words [ changed-word ] each
"exclude" "include"
[ get-global " " split [ empty? not ] subset ] 2apply
seq-diff

View File

@ -29,9 +29,8 @@ M: object root-directory? ( path -- ? ) "/" = ;
"/\\" member? ;
: path+ ( str1 str2 -- str )
>r [ path-separator? ] rtrim r>
[ path-separator? ] ltrim
>r "/" r> 3append ;
>r [ path-separator? ] right-trim "/" r>
[ path-separator? ] left-trim 3append ;
: stat ( path -- directory? permissions length modified )
normalize-pathname (stat) ;

View File

@ -236,9 +236,11 @@ unit-test
[ -1./0. 0 delete-nth ] unit-test-fails
[ "" ] [ "" [ blank? ] trim ] unit-test
[ "" ] [ "" [ blank? ] ltrim ] unit-test
[ "" ] [ "" [ blank? ] rtrim ] unit-test
[ "" ] [ "" [ blank? ] left-trim ] unit-test
[ "" ] [ "" [ blank? ] right-trim ] unit-test
[ "" ] [ " " [ blank? ] left-trim ] unit-test
[ "" ] [ " " [ blank? ] right-trim ] unit-test
[ "asdf" ] [ " asdf " [ blank? ] trim ] unit-test
[ "asdf " ] [ " asdf " [ blank? ] ltrim ] unit-test
[ " asdf" ] [ " asdf " [ blank? ] rtrim ] unit-test
[ "asdf " ] [ " asdf " [ blank? ] left-trim ] unit-test
[ " asdf" ] [ " asdf " [ blank? ] right-trim ] unit-test

View File

@ -652,16 +652,16 @@ PRIVATE>
dup slice? [ { } like ] when 0 over length rot <slice> ;
inline
: ltrim ( seq quot -- newseq )
over >r [ not ] compose find drop
r> swap [ tail ] when* ; inline
: left-trim ( seq quot -- newseq )
over >r [ not ] compose find drop r> swap
[ tail ] [ dup length tail ] if* ; inline
: rtrim ( seq quot -- newseq )
over >r [ not ] compose find-last drop
r> swap [ 1+ head ] when* ; inline
: right-trim ( seq quot -- newseq )
over >r [ not ] compose find-last drop r> swap
[ 1+ head ] [ 0 head ] if* ; inline
: trim ( seq quot -- newseq )
[ ltrim ] keep rtrim ; inline
[ left-trim ] keep right-trim ; inline
: sum ( seq -- n ) 0 [ + ] reduce ;
: product ( seq -- n ) 1 [ * ] reduce ;

View File

@ -2,7 +2,7 @@
! http://www.ffconsultancy.com/free/ray_tracer/languages.html
USING: float-arrays compiler generic io io.files kernel math
math.vectors math.parser namespaces sequences
math.functions math.vectors math.parser namespaces sequences
sequences.private words ;
IN: benchmark.raytracer

View File

@ -1,7 +1,7 @@
! Factor port of
! http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnorm&lang=all
USING: float-arrays kernel math math.vectors sequences
sequences.private prettyprint words tools.time hints ;
USING: float-arrays kernel math math.functions math.vectors
sequences sequences.private prettyprint words tools.time hints ;
IN: benchmark.spectral-norm
: fast-truncate >fixnum >float ; inline

View File

@ -1,6 +1,7 @@
USING: kernel namespaces
math
math.functions
math.vectors
math.parser
hashtables sequences threads

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license.
USING: arrays hashtables io io.streams.string kernel math
math.vectors math.parser
math.vectors math.functions math.parser
namespaces sequences strings tuples system ;
IN: calendar

View File

@ -1,8 +1,9 @@
! Copyright (C) 2006, 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel math math.parser models sequences ui ui.gadgets
ui.gadgets.controls ui.gadgets.frames ui.gadgets.labels
ui.gadgets.packs ui.gadgets.sliders ui.render ;
USING: kernel math math.functions math.parser models sequences
ui ui.gadgets ui.gadgets.controls ui.gadgets.frames
ui.gadgets.labels ui.gadgets.packs ui.gadgets.sliders ui.render
;
IN: color-picker
! Simple example demonstrating the use of models.

View File

@ -1,7 +1,8 @@
! Copyright (C) 2007 Eduardo Cavazos
! See http://factorcode.org/license.txt for BSD license.
USING: kernel combinators arrays sequences math combinators.lib ;
USING: kernel combinators arrays sequences math math.functions
combinators.lib ;
IN: colors.hsv

View File

@ -127,7 +127,7 @@ SYMBOL: K
: file>sha1 ( file -- sha1 ) <file-reader> stream>sha1 ;
: string>sha1-interleave ( string -- )
[ zero? ] ltrim
[ zero? ] left-trim
dup length odd? [ 1 tail ] when
seq>2seq [ string>sha1 ] 2apply
swap 2seq>seq ;

View File

@ -1,5 +1,5 @@
USING: kernel combinators sequences math math.vectors mortar slot-accessors
USING: kernel combinators sequences math math.functions math.vectors mortar slot-accessors
x x.widgets.wm.root x.widgets.wm.frame combinators.lib ;
IN: factory.commands

View File

@ -32,7 +32,7 @@ M: windows-nt-io normalize-pathname ( string -- string )
dup first CHAR: \\ = [ CHAR: \\ , ] unless %
] "" make
] }
} cond [ "/\\." member? ] rtrim ;
} cond [ "/\\." member? ] right-trim ;
SYMBOL: io-hash

View File

@ -17,7 +17,7 @@ M: windows-io (socket-destructor) ( obj -- )
destructor-obj closesocket drop ;
M: windows-io root-directory? ( path -- ? )
[ path-separator? ] rtrim
[ path-separator? ] right-trim
dup length 2 = [
dup first Letter?
swap second CHAR: : = and

View File

@ -72,7 +72,7 @@ TUPLE: part-command channel text ;
SYMBOL: irc-client
: irc-stream> ( -- stream ) irc-client get irc-client-stream ;
: trim-: ( seq -- seq ) [ CHAR: : = ] ltrim ;
: trim-: ( seq -- seq ) [ CHAR: : = ] left-trim ;
: parse-name ( string -- string )
trim-: "!" split first ;
: irc-split ( string -- seq )

View File

@ -9,7 +9,7 @@ IN: math.fft
: odd ( seq -- seq ) 2 group 1 <column> ;
DEFER: fft
: two ( seq -- seq ) fft 2 v/n dup append ;
: omega ( n -- n ) recip -2 pi i * * * exp ;
: omega ( n -- n ) recip -2 pi i* * * exp ;
: twiddle ( seq -- seq ) dup length dup omega swap n^v v* ;
: (fft) ( seq -- seq ) dup odd two twiddle swap even two v+ ;
: fft ( seq -- seq ) dup length 1 = [ (fft) ] unless ;

View File

@ -22,7 +22,7 @@ PRIVATE>
: p= ( p p -- ? ) pextend = ;
: ptrim ( p -- p )
dup length 1 = [ [ zero? ] rtrim ] unless ;
dup length 1 = [ [ zero? ] right-trim ] unless ;
: 2ptrim ( p p -- p p ) [ ptrim ] 2apply ;
: p+ ( p p -- p ) pextend v+ ;

View File

@ -88,7 +88,7 @@ M: string b, ( n string -- ) heap-size b, ;
"\0" read-until [ drop f ] unless ;
: read-c-string* ( n -- str/f )
read [ 0 = ] rtrim dup empty? [ drop f ] when ;
read [ 0 = ] right-trim dup empty? [ drop f ] when ;
: (read-128-ber) ( n -- n )
1 read first

View File

@ -111,11 +111,11 @@ M: or-parser (parse) ( input parser1 -- list )
#! input. This implements the choice parsing operator.
[ or-parser-p1 ] keep or-parser-p2 >r dupd parse swap r> parse lappend ;
: ltrim-slice ( string -- string )
: left-trim-slice ( string -- string )
#! Return a new string without any leading whitespace
#! from the original string.
dup empty? [
dup first blank? [ 1 tail-slice ltrim-slice ] when
dup first blank? [ 1 tail-slice left-trim-slice ] when
] unless ;
TUPLE: sp-parser p1 ;
@ -127,7 +127,7 @@ C: sp sp-parser ( p1 -- parser )
M: sp-parser (parse) ( input parser -- list )
#! Skip all leading whitespace from the input then call
#! the parser on the remaining input.
>r ltrim-slice r> sp-parser-p1 parse ;
>r left-trim-slice r> sp-parser-p1 parse ;
TUPLE: just-parser p1 ;

View File

@ -1,5 +1,5 @@
USING: kernel math math.vectors sequences self ;
USING: kernel math math.functions math.vectors sequences self ;
IN: pos

View File

@ -164,7 +164,7 @@ TUPLE: unimplemented-typeflag header ;
! Long file name
: typeflag-L ( header -- )
<string-writer> [ read-data-blocks ] keep
>string [ CHAR: \0 = ] rtrim filename set
>string [ CHAR: \0 = ] right-trim filename set
global [ "long filename: " write filename get . flush ] bind
filename get tar-path+ make-directories ;

View File

@ -1,7 +1,7 @@
! Copyright (C) 2006, 2007 Alex Chapman
! See http://factorcode.org/license.txt for BSD license.
USING: kernel sequences math tetris.board tetris.piece
tetris.tetromino lazy-lists combinators system ;
USING: kernel sequences math math.functions tetris.board
tetris.piece tetris.tetromino lazy-lists combinators system ;
IN: tetris.game
TUPLE: tetris pieces last-update update-interval rows score game-state paused? running? ;

View File

@ -0,0 +1,28 @@
USING: tools.deploy sequences io.files io.launcher io
kernel concurrency prettyprint ;
"." resource-path cd
"deploy-log" make-directory
{
"automata.ui"
"boids.ui"
"bunny"
"color-picker"
"gesture-logger"
"golden-section"
"hello-world"
"hello-ui"
"lsys.ui"
"maze"
"nehe"
"tetris"
"catalyst-talk"
} [
dup
"deploy-log/" over append <file-writer>
[ deploy ] with-stream
dup file-length 1024 /f
2array
] parallel-map .

View File

@ -3,7 +3,7 @@ kernel concurrency ;
"." resource-path cd
"mkdir deploy-log" run-process
"deploy-log" make-directory
{
"automata.ui"