input-stream swap with-variable ; inline
: with-input-stream ( stream quot -- )
- [ with-input-stream* ] curry with-disposal ; inline
+ '[ _ with-input-stream* ] with-disposal ; inline
: with-output-stream* ( stream quot -- )
output-stream swap with-variable ; inline
: with-output-stream ( stream quot -- )
- [ with-output-stream* ] curry with-disposal ; inline
+ '[ _ with-output-stream* ] with-disposal ; inline
: with-error-stream* ( stream quot -- )
error-stream swap with-variable ; inline
: with-error-stream ( stream quot -- )
- [ with-error-stream* ] curry with-disposal ; inline
+ '[ _ with-error-stream* ] with-disposal ; inline
: with-output+error-stream* ( stream quot -- )
- [ dup ] dip [ with-error-stream* ] curry with-output-stream* ; inline
+ dupd '[ _ with-error-stream* ] with-output-stream* ; inline
: with-output+error-stream ( stream quot -- )
- [ with-output+error-stream* ] curry with-disposal ; inline
+ '[ _ with-output+error-stream* ] with-disposal ; inline
: with-output>error ( quot -- )
error-stream get swap with-output-stream* ; inline
output-stream get swap with-error-stream* ; inline
: with-streams* ( input output quot -- )
- swapd [ with-output-stream* ] curry with-input-stream* ; inline
+ swapd '[ _ with-output-stream* ] with-input-stream* ; inline
: with-streams ( input output quot -- )
! We have to dispose of the output stream first, so that
! if both streams point to the same FD, we get to flush the
! buffer before closing the FD.
- swapd [ with-output-stream ] curry with-input-stream ; inline
+ swapd '[ _ with-output-stream ] with-input-stream ; inline
: with-input-output+error-streams* ( input output+error quot -- )
- swapd [ with-output+error-stream* ] curry with-input-stream* ; inline
+ swapd '[ _ with-output+error-stream* ] with-input-stream* ; inline
: with-input-output+error-streams ( input output+error quot -- )
- swapd [ with-output+error-stream ] curry with-input-stream ; inline
+ swapd '[ _ with-output+error-stream ] with-input-stream ; inline
: print ( str -- ) output-stream get stream-print ; inline
input-stream get stream-read-partial-into ; inline
: each-stream-line ( ... stream quot: ( ... line -- ... ) -- ... )
- [ [ stream-readln ] curry ] dip while* ; inline
+ [ '[ _ stream-readln ] ] dip while* ; inline
: each-line ( ... quot: ( ... line -- ... ) -- ... )
input-stream get swap each-stream-line ; inline
input-stream get stream-contents ; inline
: stream-copy* ( in out -- )
- [ stream-write ] curry each-stream-block ; inline
+ '[ _ stream-write ] each-stream-block ; inline
: stream-copy ( in out -- )
- [ [ stream-copy* ] with-disposal ] curry with-disposal ; inline
+ '[ _ [ stream-copy* ] with-disposal ] with-disposal ; inline
! Default implementations of stream operations in terms of read1/write1
] if ; inline recursive
: finalize-read-until ( seq sep/f -- seq/f sep/f )
- 2dup [ empty? ] [ not ] bi* and [ 2drop f f ] when ; inline
+ [ [ f ] when-empty f ] unless* ; inline
: read-until-loop ( seps stream -- seq sep/f )
[ [ stream-read1 dup [ rot member? not ] [ nip f ] if* ] 2curry [ ] ]
M: input-stream stream-seekable? drop f ; inline
M: input-stream stream-length drop f ; inline
-M: output-stream stream-write [ stream-write1 ] curry each ; inline
+M: output-stream stream-write '[ _ stream-write1 ] each ; inline
M: output-stream stream-flush drop ; inline
M: output-stream stream-nl CHAR: \n swap stream-write1 ; inline
M: output-stream stream-seekable? drop f ; inline