Re: How to see runtime-output of lisp-process ?



Marco simon <marco_simon@xxxxxx> writes:
> I'm quite new to lisp an I've still some problems
> with the lisp-handling.
> My current Problem:
> I've got a little application, based on ucw which
> sends the final output (triggered by http-requests)
> to the browser (parsed to html-code).
>
> For testing and debugging-purpose I'd like to set some
> "show me your current value" outputs in the lisp-code
> which give me information about the variables' values.
> (somethin like (print *myvalue*) )
>
> Now my Problem: I write my code in emacs, send it to
> slime for compilation --> the slime-repl shows me some
> compilation info. After that point my code is productive
> and is executed as soon as I visite the Website which
> uses that code. But: I don't know where I can see the Output
> of (print *myvalue*) - the Repl doesn't tell me and I've no
> idea where else I should look for the output.

This is not related to UCW, it's a pure slime problem.
The stream between swank and slime is heavily buffered (probably in
slime, not in swank).

Even with a newline and a FINISH-OUTPUT (or CLEAN-OUTPUT):

; SLIME 2005-07-06
(loop for i from 0 to 10 do
(when (= 5 i) (print :hello) (terpri) (finish-output)) (sleep 1))

won't display :HELLO before the end of the loop.


Alternatives:

- use inferior-lisp, it works nicely.

- open a logging/debugging stream on an xterm, or to somewhere else.
For example in clisp with or without slime:
(with-open-stream (*log* (EXT:MAKE-XTERM-IO-STREAM))
(loop for i from 0 to 10 do
(when (= 5 i) (print :hello *log*)) (sleep 1)))
works perfectly.

- a standard way to do it would be:
M-x shell RET touch /tmp/log ; tail -f /tmp/log RET
and in slime:
(with-open-file (*log* "/tmp/log" :direction :output :if-exists :append)
(loop for i from 0 to 10 do
(when (= 5 i)
(print :hello *log*) (terpri *log*) (finish-output *log*))
(sleep 1)))

--
__Pascal Bourguignon__ http://www.informatimago.com/
The rule for today:
Touch my tail, I shred your hand.
New rule tomorrow.
.



Relevant Pages

  • Re: UnCommon Web intro video
    ... >for UCW but also, as a byproduct, you show how ... >to use Emacs and SLIME effectively. ... authenticate the connection (I assume it's going over SSL, ...
    (comp.lang.lisp)
  • Re: Why Lisp for web applications?
    ... >> - If you're using swank and SLIME, you can connect to your running ... > ok, I am playing toying with dynamic web pages and lisp, but I ... Press enter when prompted for the host and port (assuming that the port ...
    (comp.lang.lisp)
  • Re: sbcl - how to get a REPL for a created thread?
    ... With that version of SBCL, you need to get the CVS version of Slime. ... You'll then need to start Swank ... So you now have Slime with 1 Slime REPL. ...
    (comp.lang.lisp)
  • Re: Several REPL attached to a single image
    ... T. From Slime, you can use `slime-connect' to connect to as many swank ... swank server from multiple locations. ...
    (comp.lang.lisp)
  • Re: How to see runtime-output of lisp-process ?
    ... > This is not related to UCW, it's a pure slime problem. ... > The stream between swank and slime is heavily buffered (probably in ... > slime, not in swank). ...
    (comp.lang.lisp)