I would like to display the text and then overwrite it (for simple progress indicators, etc.). The usual carriage return display trick ( "\r" ) works fine when running Racket in a terminal on Linux and Windows, but in DrRacket and GRacket, carriage return does not seem to move the cursor to the beginning of the line.
Using this code as an example:
(for ([x 5]) (display "\r") (display x) (flush-output) ; The result is the same with or without this line (sleep 0.1))
Running in the terminal results in a counter that overwrites itself; at the end, only 4 displayed in the terminal.
Running in DrRacket causes the numbers to be displayed and not overwritten:
0 1 2 3 4
Is there a way to rewrite a line of text in the DrRacket interaction window?
source share