racket -m from commandline

32 views
Skip to first unread message

whuk...@gmail.com

unread,
Dec 17, 2022, 11:50:49 AM12/17/22
to Racket Users
racket --help says:

  -m, --main
     Call `main` with command-line arguments, print results

but I cannot get this to work. All I get is 

main: not defined or required into the top-level environment

in all (to me) conceivable variants. Could anyone provide an actually working example?
Please don't recommend books or so, I have a life.

Thanks.

David Van Horn

unread,
Dec 17, 2022, 12:09:29 PM12/17/22
to whuk...@gmail.com, Racket Users
You likely want to also use the -t option so that the module is required.  Here's an example:

% cat try.rkt

#lang racket

(provide main)

(define (main . args)

  (displayln (cons "HELLO:" args)))

% racket -tm try.rkt there

(HELLO: there)



--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/beaa2ef6-afd2-4686-829a-390eb69f5620n%40googlegroups.com.
 
Beyond the Racket Users Google Group, Racket Discussions take place on Discourse ( https://racket.discourse.group/ ) and Discord ( https://discord.gg/6Zq8sH5 ). Discussion (but less active) also takes place on the Racket Slack https://racket.slack.com/ ( sign up at https://racket-slack.herokuapp.com/ ), and IRC #racket https://kiwiirc.com/nextclient/irc.libera.chat/#racket
---
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/10d44364-fafb-4ead-9b35-2ed5a70f827fn%40googlegroups.com.

Wolfgang Hukriede

unread,
Dec 17, 2022, 12:19:28 PM12/17/22
to David Van Horn, Racket Users
Great, thanks David, that did the trick.
And someone might want to fix the "racket --help" output, if you ask me.
Happy holidays!
>> <https://groups.google.com/d/msgid/racket-users/10d44364-fafb-4ead-9b35-2ed5a70f827fn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
Reply all
Reply to author
Forward
0 new messages