# Exercise: Reading Fixed Bytes
#
# `io.read-n` reads up to N bytes from stdin.
#
# Stack effect: ( Int -- String Int )
#   ( bytes 1 ) when all N bytes were read
#   ( bytes 0 ) on EOF / partial read / error
#               (the String may be shorter than N)
#
# This is useful for binary protocols or fixed-format data,
# where messages are byte-counted rather than line-terminated.
#
# Example:
#   4 io.read-n   # Read up to 4 bytes, returns ( "..." 1|0 )
#
# Your task: Understand fixed-size reads.
#
# As with the other read exercises, the REPL competes for stdin
# and is a poor place to try this. Use a shebang script and pipe
# input in. `io.read-n` returns ( String Int ): the bytes plus a
# status (1 if the full N were read, 0 otherwise) — drop the
# status to print just the bytes:
#
#   #!/usr/bin/env seqc
#
#   : main ( -- )
#       4 io.read-n drop io.write-line
#   ;
#
#   $ chmod +x read4.seq
#   $ printf "helloworld" | ./read4.seq    # prints: hell
#
# When done, delete the marker line below.

# I AM NOT DONE

: test-read-n ( -- )
    # Can't test without actual input
    true test.assert
;
