Welcome to the CHICKEN Scheme pasting service

char-ready? issues added by klm` on Sat Mar 10 09:13:18 2012


;; I expected this to work like the tcp-version below:
(use srfi-1 srfi-18 tcp)
(let loop ()
  (if (char-ready?)
      (print "r: " (read-char))
      (print "no char"))
  (thread-sleep! 1)
  (loop))

;; if i type in abc<ret> in the terminal with the code above,
;; it reads the first 'a' and then waits for another return
;; before it reads the remaining bc<ret>. why?

;; This works like I expect it to:
;; entering 'abc'<ret> in a connected terminal
;; reads abc<ret>
(let-values ([(i o) (tcp-accept (tcp-listen 1234))])
            (let loop ()
              (if (char-ready? i)
                  (print "r: " (read-char i))
                  (print "no char"))
              (thread-sleep! 1)
              (loop)))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What's the Makefile target to generate the bootstrap compiler of CHICKEN?
Visually impaired? Let me spell it for you (wav file) download WAV