[racket] REPL and read-line

From: Alexandre Moreira (alexandream at gmail.com)
Date: Thu Jan 6 21:01:27 EST 2011

Thanks everyone for your responses. Unfortunately I planned on using
the REPL as a kind of shell for a little utility I need, so I guess
I'll only have to live with it. Is it possible to run DrRacket in a
"REPL-only" mode? I'm making a shell to deal with some data I save on
a S-Expr "database". Is there any sort of repl (even graphical ones,
but simple) that I can work much like I work on racket repl without
loading a full fledged DrRacket environment?

On Thu, Jan 6, 2011 at 8:00 PM, Hendrik Boom <hendrik at topoi.pooq.com> wrote:
> On Thu, Jan 06, 2011 at 04:09:49PM -0200, Alexandre Moreira wrote:
>> Hello, everyone. I'm trying to use the (read-line) function in
>> racket's REPL  and I'm having a weird problem. Whenever I type
>> (read-line) in the REPL prompt it returns the empty string. It's as if
>> it is receiving the linefeed character I use to enter the command on
>> the REPL.
>
> You could try to call (read-line) twice and see if the secone one
> returns what you want.  This would confirm your suspicions,

Hendrik, I already do that. My workaround so far is to write a functon
somewhat like this
(define (my-read-line)
  (let ([contents (read-line)])
    (if (string=? contents "")
      (read-line)
      contents)))

It works, but it's kinda annoying to need that.
>
> -- hendrik
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>



-- 
"Bad programming is easy. Idiots can learn it in 21 days, even if they
are dummies."
- As seen in 'How to Design Programs'


Posted on the users mailing list.