Handbook
Glossary
(peek) ( n bs endian> subseq-endian -- bits )
Vocabulary
bitstreams
Inputs
n
an
object
bs
an
object
endian>
an
object
subseq-endian
an
object
Outputs
bits
an
object
Definition
USING:
accessors
combinators
kernel
math
sequences
;
IN:
bitstreams
::
(peek)
( n bs endian> subseq-endian -- bits )
n bs
enough-bits?
[
n bs
not-enough-bits
]
unless
bs
[
byte-pos>>
]
[
bit-pos>>
n
+
]
bi
#bits>#bytes
dupd
+
bs
bytes>>
subseq
endian> ( seq -- x )
execute-effect
n bs subseq-endian ( bignum n bs -- bits )
execute-effect
;