[plt-scheme] integer->byte?
Hello all:
Part of the old code I'm updating depended on passing around lists of
char data. What I was really doing was sending out lists of bytes and
receiving other lists of bytes from a variety of serial devices. (I had
been using strings, but found that manipulating lists of bytes was less
ambiguous in important cases, and I didn't have to keep track of lengths
and terminating characters.)
I see all the byte string manipulation things, and those look ok to me.
But what I really want is to be able to manipulate a list of 8-bit
values, to send to and receive from a serial device. For example, how
do I turn the literal value #x7f into an eight-bit value? There is no
integer->byte command.
To be more specific, I used to have this:
(define header (list (integer->char #x7e)))
(define middle (list (integer->char #x05)
(integer->char #x47)))
(define footer (list (integer->char #xff)))
But I can't see how to write this in the brave new byte world. Can
anyone suggest how something like this should read?
The (list->byte) function doesn't really do what I want, since it
creates something comparable to a string and not something list-like.
Many thanks (again),
-tom
--
------------------------
tomfool at as220 dot org
http://sgouros.com
http://whatcheer.net