[racket] Is there any tool like curses in Racket?

From: 亀田馬志 (masashi.kameda at gmail.com)
Date: Mon Feb 3 02:50:15 EST 2014

Hello.

I was writing a code like this:

(define *maxrow* 24)

(define (showfile filename)
  (with-handlers ((exn:fail:filesystem:errno?
                   (lambda (exn) #f)))
    (letrec ((openfile
              (lambda ()
                (with-input-from-file filename
                  (lambda ()
                    (let loop ((ls '()) (lbuffer (read-line)))
                      (if (eof-object? lbuffer)
                          (reverse ls)
                          (loop (cons lbuffer ls) (read-line)))))))))
      (let loop ((irow 0) (lbuffer (openfile)))
        (cond ((null? lbuffer) #f)
              ((= irow (- *maxrow* 3)) (read) ; <- Is this a problem?
                                       (loop 0 (cdr lbuffer)))
              (else (display (car lbuffer))
                    (newline)
                    (loop (+ irow 1) (cdr lbuffer))))))))

What I'd like to do is:

1. Open a file
2. Get the context into the buffer expressed as a list.
3. Show the context in 21 rows.
4. Hit Return Key to see the next 21 rows <- HERE IS THE PROBLEM!
5. Continue 3 -> 4 till the end of the buffer.

I tried READ function to do this; however it simply didn't work, 'cause
READ got to get something. READ doesn't give up eventhough just hitting a
RETURN.
Is there any function to do this instead of READ?

Possibly need some library like curses in UNIX (though I now use Windows).
Supposing to write a text editor like vi with Racket, how do you guys to
write codes using h, j, k, and l keys as cursor? In the case with standard
input and output, as you know, it is impossible to emulate the move.
Is there any library to emulate something like curses in Racket?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140203/0cc8aadb/attachment-0001.html>

Posted on the users mailing list.