
@advait.raykar has joined the channel

How would I be able to to take live interactive input from the terminal? As in, not a REPL style, like if I press p, its immediately registered, instead of waiting to press enter?

Would making a custom port be the right approach here?

Surprisingly it’s a bit tricky. It depends on the terminal.

you should be able to use read-char
. However, note that your terminal may be buffering input, so you’ll have to work with that.

I think read-char
blocks?

Perhaps peek-char
` ?

yes, it does

but in “normal” use it will also not get anything until you hit enter because the terminal is buffering

I think Advait doesn’t want to wait for enter?

Right, but you have to deal with that at the terminal level, I believe.

True.


charterm-byte-ready? and charterm-read-key looks promising.

I am checking out charterm rn, custom port creation seemed a little daunting for a racket beginner like me.

Just checking - are you using DrRacket or not?

Yep, using DrRacket

I don’t think charterm works inside DrRacket.

Yeah, that is okay. I intend on finally running my code in the terminal. DrRacket just has a nice debugger, and highlighting, so sticking to it for dev.

Cool.

This is gold, worked exactly as expected. Thanks guys, crazy supportive group here.