[racket] integer->bytestring for a single byte?

From: Paul Meier (pablo.a.meier at gmail.com)
Date: Wed Nov 7 22:12:01 EST 2012

Hi friends,

I'm trying to write some integer values to a socket, and normally I'm
generating the bytestring with
and reading values on the other end with

Sometimes, however, I'd like to send or read only a single byte, but the
contracts for those functions will only format the numbers if the
bytestring buffer that is written to or read from is 2, 4, or 8.

Is there a way to achieve a similar result (a machine-formatted bytestring)
for values that fit in a byte? And if enthusiastic pedants want are feeling
instructive to an willing learner, why are those values in the contract?

Thanks, and congrats on the new release ^_^

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121107/dcf1eca1/attachment.html>

Posted on the users mailing list.