[r6rs-discuss] ANN: R6RS benchmarks
William D Clinger
will at ccs.neu.edu
Sat Dec 1 09:53:52 EST 2007
> This may be obvious to you, but I'm having a hard time figuring
> this out.
All too little of the R6RS is obvious to me. This
is not one of the obvious bits.
> How does this work exactly?
> (dotest (teststring #\" #\linefeed #\return #\return #\linefeed
> #\x85 #\return #\x85 #\x2028 #\")
> (list (teststring #\linefeed #\linefeed #\linefeed
> #\linefeed #\linefeed #\linefeed)))
> Basically, you're doing (open-string-input-port s) which
> "returns a textual input port ... may or may not have a
> transcoder ... if it does, the transcoder is implementation
> Where did you say in your code that the eols should turn to
> linefeeds? Isn't an implementation allowed to use an eol-
> style of "none" in their implementation-dependent transcoder
> for textual ports opened with open-string-input-port?
The code doesn't have to say it, because R6RS 4.2.2 says
In a string literal, a <line ending> not preceded by
a \ stands for a linefeed character, which is the
standard line-ending character of Scheme.
The first call to teststring returns
The dotest procedure turns that string into a string port
from which a string literal will be read by get-datum.
The characters of that string literal consist of six
consecutive <line ending>s that are not preceeded by a \.
According to R6RS 4.2.2, get-datum must return a string
consisting of six consecutive linefeeds.
More information about the r6rs-discuss