axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] RE: output capture


From: Bill Page
Subject: [Axiom-developer] RE: output capture
Date: Sun, 22 May 2005 00:39:18 -0400

On May 22, 2005 12:05 AM Tim Daly wrote:

> Perhaps you could rebind the output stream?
> I'm not sure if *standard-output* is used. But the idea
> is:
>
>)lisp 
>  (progn 
>    ; we need a new output stream
>    (setq tmpout (make-string-output-stream))
>    ; we hold on to the regular output stream
>    (setq save *standard-output*)
>    ; we capture the regular output stream in our string-stream
>    (setq *standard-output* tmpout)
>    ; we generate output
>    (|parseAndInterpret| "(x+1)^9")
>    ; we get the output strings
>    (setq result (get-output-stream-string tmpout))
>    ; restore the regular output stream
>    (setq *standard-output* save)
>    ; and return the strings
>    result)

Yes, that seems like a very good approach.

> There should be several lines written to tmpout and returned
> in result. I'm not sure that axiom uses *standard-output* but
> the output stream must exist somewhere.

Apparently it does not use *standard-output* as the following
example shows :(

(1) -> )lisp (progn (setq tmpout (make-string-output-stream)) (setq save
*standa
rd-output*) (setq *standard-output* tmpout) (|parseAndInterpret|
"(x+1)^9") (set
q result (get-output-stream-string tmpout)) (setq *standard-output*
save) result
)
   Loading c:/Program Files/axiom/mnt/windows/algebra/UPMP.o for
      package UnivariatePolynomialMultiplicationPackage

         9     8      7      6       5       4      3      2
   (1)  x  + 9x  + 36x  + 84x  + 126x  + 126x  + 84x  + 36x  + 9x + 1
                                              Type: Polynomial Integer

Value = ""

(2) ->

But it was certainly a good try!

> I'll look at the code tomorrow. Gotta get back to packing.

Thanks. If you are like me, I am sure that almost any excuse
could distract you from that sort of job! :) I hate packing...

Regards,
Bill Page.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]