[plt-scheme] Noticeable absence of (with-output-to-port ...) and (with-input-from-port ...)

From: Robby Findler (robby at cs.uchicago.edu)
Date: Thu Sep 11 10:18:48 EDT 2008

On Thu, Sep 11, 2008 at 8:36 AM, Ernie Smith <esmith at acanac.net> wrote:
> I was looking to redirect intput and output of existing
> scheme functions to pipes.
> In the spirit of  "The art of taking out the weakness that  causes the  need
> to add features" (forgive the paraphrase, I couldn't find the original
> quote),

Its the introduction of the RnRS reports. eg:

> I am
> surprised to find that  though (with-output-to-file ...) is defined,
> the more general (with-output-to-port ...)  appears to be lacking. It would
> seem to me that  (with-output-to-port ...) would make other
> (with-output-to-xxx ...) unnecessary, but the the converse is not true,
> so I surmise there is an underlying implementation problem or a conflict
> with a more substantial issue. Perhaps someone could edify me on this.
> Why is it missing?

With-output-to-port wouldn't do anything. Output already goes to a
port. The one returned by current-output-port. Input also comes from a
port; you guessed it: current-input-port.

You might try reading about those in help desk. Be sure to also read
about the scheme/port library which has some useful helper functions.
I suggest starting with the Guide:



Posted on the users mailing list.