[plt-scheme] line/column counting for output ports

From: Dave Herman (dherman at ccs.neu.edu)
Date: Mon Feb 28 19:11:55 EST 2005

> It bothers me that counting is built into input ports, actually,
> because counting seems like an orthogonal feature. For now, convenience
> has overridden my reservations on the input side.

I agree. Java's library does this nicely, with the concept of 
FilterInputStream and FilterOutputStream. Line number counting is 
implemented by LineNumberReader, which is a wrapper around an ordinary 

> For the output side, I'd recommend creating a custom port wrapper that
> adds counting to a given output port.

I've implemented a generic `make-filter-input-port' procedure in a 299 
PLaneT library:


Doug: I haven't yet implemented `make-filter-output-port' but I'll try 
to do that ASAP so you can use that to implement a line number counting 
output port.


Posted on the users mailing list.