|I seem to be missing something on how readc and readline work. They appear to include the prior <Enter> keypress as the first character that is read. So code that is trying to read four characters:|
Reads only two useful times:
arc> (let ret "" (repeat 4 (zap + ret (readc))) ret)
The first two lines are input lines that are concluded with the <Enter> button. 'readline works the same way:
The newline is at the beginning of the string; I would expect the newline that I press after typing (newline) to be consumed by the repl, and the newline that I press after typing "abc" to be in the string. Obviously, I can hack the functionality I want together:
But it seems like there should be a better way -- is there?
arc> (def my-readc ((o port (stdin))) (readc port) (readc port))