[plt-scheme] how to print to STDERR and /dev/null?

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Mar 29 11:08:45 EDT 2007

On Mar 29, Daniel Yoo wrote:
> On Wed, 28 Mar 2007, mainargv at gmail.com wrote:
> > how to print to STDERR and /dev/null? I need both ports, thanks.
> I'm not sure what you mean by printing to /dev/null.  Can you explain more 
> about this?  I thought that /dev/null was a black hole, so that printing 
> to it was ineffective.  Perhaps you're looking for OPEN-OUTPUT-NOWHERE?
> http://download.plt-scheme.org/doc/360/html/mzlib/mzlib-Z-H-33.html#node_idx_1252
> The standard error port can be found by using CURRENT-ERROR-PORT.  Here 
> are some points of reference that may help:
> http://download.plt-scheme.org/doc/360/html/r5rs/r5rs-Z-H-9.html#%25_sec_6.6.3
> http://download.plt-scheme.org/doc/360/html/mzscheme/mzscheme-Z-H-11.html#node_sec_11.2
> http://download.plt-scheme.org/doc/360/html/mzscheme/mzscheme-Z-H-7.html#node_idx_1394

In addition to `open-output-port' and `current-error-port'[*], you can
get to the physical devices using

  (open-output-file "/dev/stderr" 'append)
  (open-output-file "/dev/null" 'append)

([*] the bindings are lowercase.)

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.