Alex Shinn <firstname.lastname@example.org> wrote:
| This is similar to Guile's soft ports, which lets you define ports as a
| vector of procedures to use for reading/writing characters and strings.
| With this definition you can define a procedural port that performs
| whatever filter action you want...
| This seems like a very simple but useful feature - do any other schemes
| offer this ability?
MzScheme does. It calls them "custom ports":
The make-input-port and make-output-port procedures create ports with
arbitrary control procedures:
(make-input-port read-char-proc char-ready?-proc close-proc
[peek-char-proc]) creates an input port.
(make-output-port write-proc close-proc) creates an output port.
Ports created by make-input-port and make-output-port are immediately
open for reading or writing. If the close procedure does not have any
side-effects, then the custom port does not need to be explicitly closed.
If you don't need to get control on *every* character, MzScheme also
provides "string ports":
Scheme input and output can be read from or collected into a string:
(open-input-string string) creates an input port that reads
characters from string.
(open-output-string) creates an output port that accumulates
the output into a string.
(get-output-string string-output-port) returns the string
accumulated in string-output-port.
Rob Warnock, 30-3-510 <email@example.com>
SGI Network Engineering <http://reality.sgiweb.org/rpw3/>
1600 Amphitheatre Pkwy. Phone: 650-933-1673
Mountain View, CA 94043 PP-ASEL-IA
[Note: firstname.lastname@example.org and email@example.com aren't for humans ]