advait.raykar
2020-6-17 17:11:30

@advait.raykar has joined the channel


advait.raykar
2020-6-17 17:12:36

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?


advait.raykar
2020-6-17 17:14:59

Would making a custom port be the right approach here?


soegaard2
2020-6-17 17:19:53

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


samth
2020-6-17 17:20:16

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.


soegaard2
2020-6-17 17:21:00

I think read-char blocks?


soegaard2
2020-6-17 17:21:13

Perhaps peek-char` ?


samth
2020-6-17 17:21:14

yes, it does


samth
2020-6-17 17:21:45

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


soegaard2
2020-6-17 17:22:15

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


samth
2020-6-17 17:22:38

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


soegaard2
2020-6-17 17:23:31

True.


soegaard2
2020-6-17 17:26:21

soegaard2
2020-6-17 17:27:55

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


advait.raykar
2020-6-17 17:29:31

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


soegaard2
2020-6-17 17:30:46

Just checking - are you using DrRacket or not?


advait.raykar
2020-6-17 17:32:33

Yep, using DrRacket


soegaard2
2020-6-17 17:32:54

I don’t think charterm works inside DrRacket.


advait.raykar
2020-6-17 17:33:54

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.


soegaard2
2020-6-17 17:34:03

Cool.


advait.raykar
2020-6-17 17:45:10

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