[racket] port open or closed?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Oct 20 10:57:47 EDT 2011

At Thu, 20 Oct 2011 15:35:39 +0200, "Jos Koot" wrote:
> May be I am myopic, but I have not found any tools in the docs to check
> whether a port is open or closed. After a port is closed, it may survive. It
> would be handy to have:
>  
> 1: a procedure that tells whether or not a port is open.

That's `port-closed?'.

> 2: a procedure that given a closed port, reopens it or returns its path (or
> other info about the port, for example, it may be an output-string or a
> console)

The `object-name' function tends to give you a path for a file port.



Posted on the users mailing list.