Peeking at the next character without consuming it is useful when the interpretation of “this character” depends on what the next one is.
peek_byte(
N)
unifies N with the next unconsumed
byte from the current input stream, which must be binary.
peek_code(
N)
unifies N with the next unconsumed
character code from the current input stream, which must be text.
peek_char(
A)
unifies A with the next unconsumed
character atom from the current input stream, which must be text.