Cat’s hacks:

toerr

Send output going to stdout to stderr instead

toerr1.patch

diff --git a/arc.arc b/arc.arc
index 3ae2830..0496d63 100644
--- a/arc.arc
+++ b/arc.arc
@@ -782,6 +782,9 @@
       (w/stdout ,gv ,@body)
       (inside ,gv))))
 
+(mac toerr body
+  `(w/stdout (stderr) ,@body))
+
 (mac fromstring (str . body)
   (w/uniq gv
    `(w/instring ,gv ,str
@@ -1419,7 +1422,7 @@
   `(let ,var (table) ,@body ,var))
 
 (def ero args
-  (w/stdout (stderr) 
+  (toerr
     (each a args 
       (write a)
       (writec #\space))

description

This is a little macro that I find useful. It takes output that normally would go to stdout and sends it to stderr instead. (I call it toerr by analogy with tostring, which takes output going to stdout and puts it in a string).

When used inside of a defop, it causes output to print on the Arc REPL instead of being sent to the user’s browser.

 (defop foo req
   (toerr:ppr ...)

get this hack

wget http://ycombinator.com/arc/arc3.tar
tar xf arc3.tar
cd arc3
wget -O - http://hacks.catdancer.ws/toerr1.patch | patch

license

public domain