Cleanups and fixes

db4
Slava Pestov 2008-02-23 22:48:45 -06:00
parent 46ab3bdd18
commit cc600ad54f
6 changed files with 15 additions and 15 deletions

View File

@ -116,7 +116,7 @@ M: method-spec definition
: forget-method ( class generic -- ) : forget-method ( class generic -- )
check-method check-method
[ delete-at* ] with-methods [ delete-at* ] with-methods
[ method-word forget ] [ drop ] if ; [ method-word forget-word ] [ drop ] if ;
M: method-spec forget* M: method-spec forget*
first2 forget-method ; first2 forget-method ;

View File

@ -310,13 +310,11 @@ M: immutable-sequence clone-like like ;
<PRIVATE <PRIVATE
: iterate-seq >r dup length swap r> ; inline
: (each) ( seq quot -- n quot' ) : (each) ( seq quot -- n quot' )
iterate-seq [ >r nth-unsafe r> call ] 2curry ; inline >r dup length swap [ nth-unsafe ] curry r> compose ; inline
: (collect) ( quot into -- quot' ) : (collect) ( quot into -- quot' )
[ >r over slip r> set-nth-unsafe ] 2curry ; inline [ >r keep r> set-nth-unsafe ] 2curry ; inline
: collect ( n quot into -- ) : collect ( n quot into -- )
(collect) each-integer ; inline (collect) each-integer ; inline
@ -415,7 +413,7 @@ PRIVATE>
>r dup length 1- swap r> (monotonic) all? ; inline >r dup length 1- swap r> (monotonic) all? ; inline
: interleave ( seq between quot -- ) : interleave ( seq between quot -- )
[ (interleave) ] 2curry iterate-seq 2each ; inline [ (interleave) ] 2curry >r dup length swap r> 2each ; inline
: unfold ( pred quot tail -- seq ) : unfold ( pred quot tail -- seq )
V{ } clone [ V{ } clone [
@ -695,9 +693,9 @@ PRIVATE>
: sequence-hashcode-step ( oldhash newpart -- newhash ) : sequence-hashcode-step ( oldhash newpart -- newhash )
swap [ swap [
dup -2 fixnum-shift >fixnum swap 5 fixnum-shift >fixnum dup -2 fixnum-shift-fast swap 5 fixnum-shift-fast
fixnum+fast fixnum+fast fixnum+fast fixnum+fast
] keep bitxor ; inline ] keep fixnum-bitxor ; inline
: sequence-hashcode ( n seq -- x ) : sequence-hashcode ( n seq -- x )
0 -rot [ 0 -rot [

View File

@ -34,10 +34,10 @@ IN: benchmark.sockets
: socket-benchmarks : socket-benchmarks
10 clients 10 clients
20 clients 20 clients
40 clients 40 clients ;
80 clients ! 80 clients
160 clients ! 160 clients
320 clients ! 320 clients
640 clients ; ! 640 clients ;
MAIN: socket-benchmarks MAIN: socket-benchmarks

2
extra/sequences/next/next.factor Normal file → Executable file
View File

@ -3,6 +3,8 @@ IN: sequences.next
<PRIVATE <PRIVATE
: iterate-seq >r dup length swap r> ; inline
: (map-next) ( i seq quot -- ) : (map-next) ( i seq quot -- )
! this uses O(n) more bounds checks than is really necessary ! this uses O(n) more bounds checks than is really necessary
>r [ >r 1+ r> ?nth ] 2keep nth-unsafe r> call ; inline >r [ >r 1+ r> ?nth ] 2keep nth-unsafe r> call ; inline

View File

@ -28,7 +28,7 @@
! Connection closed by foreign host. ! Connection closed by foreign host.
USING: combinators kernel prettyprint io io.timeouts io.server USING: combinators kernel prettyprint io io.timeouts io.server
sequences namespaces io.sockets continuations ; sequences namespaces io.sockets continuations calendar ;
IN: smtp.server IN: smtp.server
SYMBOL: data-mode SYMBOL: data-mode

View File

@ -1,5 +1,5 @@
USING: math kernel sequences io.files tools.crossref tools.test USING: math kernel sequences io.files tools.crossref tools.test
parser namespaces source-files ; parser namespaces source-files generic definitions ;
IN: temporary IN: temporary
GENERIC: foo GENERIC: foo