From: Josef Eschgfaeller
Subject: Input
Date: 
Message-ID: <378333BF.61BA2D7D@felix.unife.it>
Is there a possibility to use read-line in a manner that the
terminating newline is not printed (in order that the program's
answer appears on the same line), or has one to program it with
read-char?

(defun input ()
  (with-output-to-string (alfa)
    (do ((x (read-char) (read-char)))
        ((char= x #\newline) alfa)
        (write-char x alfa))))

Surprisingly for me this does error correction (with backspace) by
itself. Why?

I work with scripts, not on the console. Thanks.

J. Eschgfaeller

From: Marco Antoniotti
Subject: Re: Input
Date: 
Message-ID: <lwaet8bwk4.fsf@copernico.parades.rm.cnr.it>
Josef Eschgfaeller <···@felix.unife.it> writes:

> Is there a possibility to use read-line in a manner that the
> terminating newline is not printed (in order that the program's
> answer appears on the same line), or has one to program it with
> read-char?
> 
> (defun input ()
>   (with-output-to-string (alfa)
>     (do ((x (read-char) (read-char)))
>         ((char= x #\newline) alfa)
>         (write-char x alfa))))
> 
> Surprisingly for me this does error correction (with backspace) by
> itself. Why?

This is a property of the reader of your CL.

BTW. Why don't you use READ-LINE?

   (defun input () (read-line))

> I work with scripts, not on the console. Thanks.

So?!?

Cheers

-- 
Marco Antoniotti ===========================================
PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY
tel. +39 - 06 68 10 03 17, fax. +39 - 06 68 80 79 26
http://www.parades.rm.cnr.it/~marcoxa
From: Kent M Pitman
Subject: Re: Input
Date: 
Message-ID: <sfwso705t1c.fsf@world.std.com>
Josef Eschgfaeller <···@felix.unife.it> writes:

> Is there a possibility to use read-line in a manner that the
> terminating newline is not printed (in order that the program's
> answer appears on the same line), or has one to program it with
> read-char?

Portable CL doesn't have control over echo behavior.

> (defun input ()
>   (with-output-to-string (alfa)
>     (do ((x (read-char) (read-char)))
>         ((char= x #\newline) alfa)
>         (write-char x alfa))))
> 
> Surprisingly for me this does error correction (with backspace) by
> itself. Why?

You're probably in line-at-a-time mode in whatever user-interface
you have with characters only being sent to lisp at the end of a line,
so you get local editing in the middle of a line.

> I work with scripts, not on the console. Thanks.

Not that it's directly relevant to your query about echoing, but
for more information on input editing, you might find this paper useful:
 http://world.std.com/~pitman/PS/Ambitious.html
It describes the working of what has traditionally been called a
"lisp machine style" rubout handler, though it's focused only on the
technique and not the I/O operations, which vary from system to system.