Handbook
Glossary
stream-peek ( n stream -- seq )
Vocabulary
io
.
streams
.
peek
Inputs
n
an
object
stream
an
object
Outputs
seq
an
object
Definition
USING:
accessors
combinators.short-circuit
io
io.private
kernel
math
sequences
;
IN:
io.streams.peek
:
stream-peek
( n stream -- seq )
2dup
peeked>>
{
[
length
<=
]
[
length
0
>
]
}
1&&
[
[
peeked>>
<reversed>
swap
head
]
[
stream-exemplar
like
]
bi
]
[
[
nip
]
[
stream-read
]
2bi
[
reverse
swap
peeked>>
push-all
]
keep
]
if
;