Merge branch 'master' of git://github.com/mrjbq7/factor

db4
Slava Pestov 2011-03-25 18:54:35 -07:00
commit 6c90529a0e
1 changed files with 9 additions and 9 deletions

View File

@ -90,10 +90,10 @@ SYMBOL: error-stream
PRIVATE>
: each-stream-line ( stream quot -- )
: each-stream-line ( ... stream quot: ( ... line -- ... ) -- ... )
swap [ stream-readln ] curry each-morsel ; inline
: each-line ( quot -- )
: each-line ( ... quot: ( ... line -- ... ) -- ... )
input-stream get swap each-stream-line ; inline
: stream-lines ( stream -- seq )
@ -102,21 +102,21 @@ PRIVATE>
: lines ( -- seq )
input-stream get stream-lines ; inline
: each-stream-block ( ... stream quot: ( ... block -- ... ) -- ... )
swap 65536 swap [ stream-read-partial ] 2curry each-morsel ; inline
: each-block ( ... quot: ( ... block -- ... ) -- ... )
input-stream get swap each-stream-block ; inline
: stream-contents ( stream -- seq )
[
[ [ 65536 swap stream-read-partial dup ] curry [ ] produce nip ]
[ [ ] collector [ each-stream-block ] dip { } like ]
[ stream-element-exemplar concat-as ] bi
] with-disposal ;
: contents ( -- seq )
input-stream get stream-contents ; inline
: each-stream-block ( stream quot: ( block -- ) -- )
swap [ 8192 swap stream-read-partial ] curry each-morsel ; inline
: each-block ( quot: ( block -- ) -- )
input-stream get swap each-stream-block ; inline
: stream-copy ( in out -- )
[ [ [ write ] each-block ] with-output-stream ]
curry with-input-stream ;