[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: read-line
// From: ihlpf!clarisse@arpa.att.com
// Please be more specific (if you can) when exchanging information
// on the "KCl i/o" problem. I never encountered what you describe.
// It probably works on certain OSs (System V) and not on others, it
// is function of your terminal i/o mode, stty... You can't generalize
// the effect of read-line from one system to another unless it is fixed
// or (does not work anywhere).
There's far too much pointless discussion on this subject already,
but I will explain again.
When the KCL toplevel reads an s-expression, it leaves the final
newline unread if the input is a list. With the newline character
still in the input stream, if the first input operation done by
the user program is a read-line, it will encounter a blank line.
This problem is obviously independent of operating system or anything
else not part of KCL.
// KCl (Kyoto Common June 3, 1987
// >(dotimes (i 5) (format t ": ~s~%" (read)))
// 1
// : 1
// 2
// : 2
// 3
// : 3
// 4
// : 4
// 5
// : 5
// NIL
This does not have the same problem because read, of course,
skips over leading whitespace, which includes newlines. Independent
of that, the read function (as oppose to read-preserving-whitespace)
probably does read a single trailing whitespace after a number.
Thank you.