[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Scheme-reports] some questions on byte vectors + ports



Hi

In the context of my "algorithm and data structures" course, I have recently developed (in R6RS) an educational implementation of the following "stack" of external algorithms&data structures:

- virtual disks : an implementation of "read-block" and "write-block" 
	on top of R6RS sequential files,
	by positioning the current of a file to a given byte number and reading/writing the number of bytes (in a byte vector) representing a disk block
- on top of this I have developed an educational file system by linking up blocks
	- in a freelist to allocate and deallocate blocks
	- in a sequence to form a primitive educational directory
- I have implemented sequential files by linking up blocks
	- read takes a scheme value, converts it to bytes and encodes the bytes in the disk blocks
	- write does the opposite
- I have implemented balanced multiway merge sort + polyphase sort on top of these sequential files. The goal was to show students the number of block transfers for external sorting.
- I have implemented SQL-styled data files as double linked lists of disk blocks storing tuples + I have implemented B+-trees as index files. The trees consist of nodes that are raw disk blocks of the first abstraction
- Finally, I have implemented a "mini SQL" that supports (create-table…) (create-index…) (select/eq? …) (delete-where!…) (insert-into-table! …) using these abstractions

I have written a draft of a textbook covering the implementation (in English). It was my intention to publish it after a few iterations.


Now the questions:

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. 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? I only see string->utf8 and utf8->string. However, converting a string to a byte vector is not the same as encoding a string in an existing byte vector. 



Regards

Wolf
_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports