[racket] Command line Racket equivalent of DrRacket's Racket | Run (CTRL+T or F5)?

From: Greg Hendershott (greghendershott at gmail.com)
Date: Mon Dec 13 12:19:27 EST 2010

I feel like I'm missing something obvious here.

Using Racket interactively from the command-line, how do I get a
similar result as choosing Racket | Run (e.g. CTRL+T or F5) in
DrRacket?

Meaning: All the expressions in the file are evaluated, and afterward
you have a prompt to do some more interactive things (or just type
"(exit)").

For instance if I have test.rkt which is

#lang scheme
(define (foo)
  (displayln "I am foo."))
(foo)

then here's what happens at the OS command line:

[1] "racket test.rkt"
Runs it: Yes.  Racket prompt: No (Racket exits automatically).
[2] "racket -i test.rkt"
Runs it: No.  Racket prompt: Yes.  Typing "foo" at prompt: "reference
to undefined identifier: foo"
[3] "racket -i -f test.rkt"
Runs it: No.  Racket prompt: Yes.  Typing "foo" at prompt: "reference
to undefined identifier: foo"
[4]  "racket _______ "
Runs it: Yes.  Racket prompt: Yes.  Typing "foo" at prompt: "#<procedure:foo>"

What is ____ in for 4?


P.S. As more background, I want to be able to do this from the command
line. So that's why I put the question that way.  But also, I'm
interested in trying to use Racket from Emacs. At the moment the only
thing I really want now is "get the same thing as pressing F5 in
DrRacket". And (again maybe I'm missing something obvious, or botched
the config) neither Racket nor Geiser seem to provide just quite that.
So I was looking at binding F5 to mode-compile and setting the correct
Racket flags ... that I haven't figured out yet, because apparently
I'm a numskull.

Thank you.


Posted on the users mailing list.