I got it to work! Thanks a lot! On Thursday, November 21, 2019 at 3:05:37 PM UTC-5, samth wrote: > > There are three things you could do here: > > 1. Start the racket REPL, use `enter!` to run the program, and then > type in your expression. This is very similar to how DrRacket works. > > 2. Make sure the relevant things are `provide`d by your module, then > `require` the module and execute an expression. Here's an example: > > [samth@huor:~/sw/plt/extra-pkgs/racket-lang-org (master) plt] cat a.rkt > #lang racket > (define x 1) > (provide x) > [samth@huor:~/sw/plt/extra-pkgs/racket-lang-org (master) plt] racket > -e "(require \"a.rkt\")" -e "(displayln x)" > 1 > > > 3. Write the program you want as a module which uses `require` to > depend on the code you've already written, and then just run that > program as `racket program.rkt`. > > I strongly recommend option 3, but any of them should work for you. > > Sam > > On Thu, Nov 21, 2019 at 2:57 PM Vignesh Krishnaraja > <[email protected] <javascript:>> wrote: > > > > I am trying to run a racket file from the command line. > > > > First thing I have to say is that when I run the program from the IDE > (Dr. Racket) it works perfectly fine. The program uses #lang racket. > > > > I tried using the -f to load the file and -e to evaluate my expression > which is "(mine-expr '((prompt1 prompt2)))" > > Racket is seeing ((prompt1 prompt2)) but it doesn't consider it as a > list. I don't know why it is not treating it as a list since I used the ' . > > > > When I run the exact same expression on DrRacket I get " '(("C" prompt1 > prompt2)) ". > > > > Also I noticed I was able to get some weird result when I escaped the > space between the two elements. > > > > What is the best way to evaluate an expression from command line using > the definitions of a file just like the way we can on DrRacket? > > > > Is there any other way to evaluate an expression through command line. > Please let me know! I almost have no clue with racket. I am trying to reuse > the racket program in my project. Thanks! > > > > > > -- > > You received this message because you are subscribed to the Google > Groups "Racket Developers" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/racket-dev/73dd4ef7-9bb4-47c9-9c10-d369b2a30b67%40googlegroups.com. > > >
-- You received this message because you are subscribed to the Google Groups "Racket Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/1b7327fc-d7d9-451b-9007-9306f6201abe%40googlegroups.com.
