Handbook
Glossary
counting-stream
Vocabulary
io
.
streams
.
counting
Definition
USING:
math
;
IN:
io.streams.counting
TUPLE:
counting-stream
stream
{
in-count
integer
initial:
0
}
{
out-count
integer
initial:
0
}
;
Methods
USING:
accessors
destructors
io.streams.counting
;
M:
counting-stream
dispose
stream>>
dispose
;
USING:
accessors
io
io.streams.counting
kernel
math
sequences
;
M::
counting-stream
stream-contents*
( stream -- seq )
stream
stream>>
stream-contents
:>
seq stream
[
seq
length
+
]
change-in-count
drop
seq
;
USING:
accessors
io
io.streams.counting
kernel
;
M:
counting-stream
stream-flush
[
stream>>
]
call
\
stream-flush
execute
;
USING:
accessors
io
io.streams.counting
kernel
;
M:
counting-stream
stream-nl
[
stream>>
]
call
\
stream-nl
execute
;
USING:
accessors
io
io.streams.counting
kernel
math
;
M::
counting-stream
stream-read-partial-unsafe
( n buf stream -- count )
n buf stream
stream>>
stream-read-partial-unsafe
:>
count stream
[
count
+
]
change-in-count
drop
count
;
USING:
accessors
io
io.streams.counting
kernel
math
;
M::
counting-stream
stream-read-unsafe
( n buf stream -- count )
n buf stream
stream>>
stream-read-unsafe
:>
count stream
[
count
+
]
change-in-count
drop
count
;
USING:
accessors
io
io.streams.counting
kernel
math
sequences
;
M::
counting-stream
stream-read-until
( seps stream -- seq sep/f )
seps stream
stream>>
stream-read-until
:>
( seq sep ) sep
[
stream
[
seq
length
+
]
change-in-count
drop
]
when
seq sep
;
USING:
accessors
io
io.streams.counting
kernel
math
;
M::
counting-stream
stream-read1
( stream -- elt )
stream
stream>>
stream-read1
dup
[
stream
[
1
+
]
change-in-count
drop
]
when
;
USING:
accessors
io
io.streams.counting
kernel
;
M:
counting-stream
stream-readln
[
stream>>
]
call
\
stream-readln
execute
;
USING:
accessors
io
io.streams.counting
kernel
math
sequences
;
M::
counting-stream
stream-write
( data stream -- )
data stream
stream>>
stream-write
stream
[
data
length
+
]
change-out-count
drop
;
USING:
accessors
io
io.streams.counting
kernel
math
;
M::
counting-stream
stream-write1
( elt stream -- )
elt stream
stream>>
stream-write1
stream
[
1
+
]
change-out-count
drop
;