[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] some questions on byte vectors + ports
Hi,
On Wed, Jun 27, 2012 at 5:06 AM, Wolfgang De Meuter <wdmeuter@x> wrote:
>
> My entire implementation-stack is based on:
> (a) the ability to read and write a byte vector from/to a sequential file/port in Scheme.
> (b) the ability to position the current of a port to a given byte number (and subsequently read/write a byte vector at that position).
> (c) the ability to encode / decode integers, floats and strings in a byte vector.
>
> I had a look at the R7RS report.
> - I cannot find (b)
> - I understood that (c) has been removed to the big language.
>
> Is (b) a conscious decision? Same question for (c) : to me, byte vectors are pretty useless if you don't have a minimal amount of comfort for encoding/decoding data types.
Yes, both are conscious. The posix module slated for
the large language will cover (b).
Moving (c) to the large language was an obvious decision.
> And, given the fact that you no longer support this comfort, is there sufficient support to break down/ build up Scheme data types (integers, float,…) into / from raw bytes ? I.e., can I convert an integer or a float to a byte vector?
Yes, the primitives read-u8 and write-u8 are all you need
for this. See the withdrawn SRFI-56 for a portable implementation.
--
Alex
_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports