This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

sbcl vs clisp

3 posts · 2143 views

Hi!
My problem is that the code below behaves differently in sbcl and clisp
(defun say-hello ()
  (princ "Please type your name:")
  (let ((name (read-line)))
    (princ "Nice to meet you, ")
    (princ name)))
In clisp i'm first prompted with "Please enter your name:"
[2]> (say-hello)
Please type your name:asd
Nice to meet you, asd 
"asd"
In sbcl, when i run (say-hello) i'm carried over to the next line without any prompt. Then when i enter something things just get weired:
* (say-hello) 
asd
Please type your name:Nice to meet you, asd 
"asd"
Can someone please explain what is going on?

/Igor

Re: sbcl vs clisp

Output buffering. On your system apparently CLISP output is not buffered, but SBCL output is line buffered, so it happens only when a newline occurs. Use FINISH-OUTPUT to guarantee that output was done and finished before progressing in the program.

Re: sbcl vs clisp

Ramarren wrote:Output buffering. On your system apparently CLISP output is not buffered, but SBCL output is line buffered, so it happens only when a newline occurs. Use FINISH-OUTPUT to guarantee that output was done and finished before progressing in the program.
Thank you. That helped :)