Re: [racket-users] Load and execute files
On 3/20/20, Alexandre Rademaker wrote: > > It works! Thank you. The B.rkt (or check.rkt in my last message) can’t have > the `#lang racket` line. I am still confused about the implications of the > `#lang racket` line in the file and the module system of Racket. Great! In this case, adding #lang puts the body of B.rkt inside a new module, which would need a require to get the definitions from the toplevel. -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAFUu9R72vD0bk4PZXQyGJAC6tkZs7vVJiWj29mMM4AX6t8GTYA%40mail.gmail.com.
Re: [racket-users] Load and execute files
It works! Thank you. The B.rkt (or check.rkt in my last message) can’t have the `#lang racket` line. I am still confused about the implications of the `#lang racket` line in the file and the module system of Racket. > On 20 Mar 2020, at 11:08, Ben Greenman wrote: > > Does check.rkt start with a #lang line? > > My B.rkt from the last message didn't have a #lang > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/16A9D698-E539-4C63-8A7D-ACCC7D4B2E24%40gmail.com.
Re: [racket-users] Load and execute files
Does check.rkt start with a #lang line? My B.rkt from the last message didn't have a #lang On 3/19/20, Alexandre Rademaker wrote: > > Not yet. To be more concrete: > > % racket --lib racket -t ex-1.2-3.rkt -t ex-1.7.rkt -t ex-1.8.rkt -r > check.rkt > check.rkt:31:7: sum-of-squares-max3: unbound identifier > in: sum-of-squares-max3 > location...: >check.rkt:31:7 > context...: >do-raise-syntax-error >for-loop >[repeats 1 more time] >finish-bodys >lambda-clause-expander >for-loop >loop >[repeats 6 more times] >module-begin-k >expand-module16 >expand-capturing-lifts >temp118_0 >temp91_0 >compile15 >temp85_0 >loop > > The ex* files are the answers of one particular student. The check.rkt > contains the tests. I am still trying to avoid the necessity of adding the > (require …) commands in the check.rkt so I can select the student files to > test in the command line. The -r or -f option cause the same error. The > (provide …) forms are presented in the ex* files. > > Best, > Alexandre > > >> On 19 Mar 2020, at 20:26, Ben Greenman >> wrote: >> >>> But I was really expecting that the option -t in the racket command >>> should >>> replace the explicit (require…) in B.rkt. Something like >>> racket -t A.rkt -f B.rkt >>> default-load-handler: expected a `module' declaration, but found >>> something >>> else >> >> Yes that almost works, but A.rkt needs to provide things for the >> require to get them. >> >> Also, I guess we need --lib racket (maybe my -I racket was a mistake): >> >> racket --lib racket -t A.rkt -f B.rkt > > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAFUu9R7ajThHa0W5qHCH42KuGfMowX%2BnZ2K-V6EbUTdFC2zYHQ%40mail.gmail.com.
Re: [racket-users] Load and execute files
Not yet. To be more concrete: % racket --lib racket -t ex-1.2-3.rkt -t ex-1.7.rkt -t ex-1.8.rkt -r check.rkt check.rkt:31:7: sum-of-squares-max3: unbound identifier in: sum-of-squares-max3 location...: check.rkt:31:7 context...: do-raise-syntax-error for-loop [repeats 1 more time] finish-bodys lambda-clause-expander for-loop loop [repeats 6 more times] module-begin-k expand-module16 expand-capturing-lifts temp118_0 temp91_0 compile15 temp85_0 loop The ex* files are the answers of one particular student. The check.rkt contains the tests. I am still trying to avoid the necessity of adding the (require …) commands in the check.rkt so I can select the student files to test in the command line. The -r or -f option cause the same error. The (provide …) forms are presented in the ex* files. Best, Alexandre > On 19 Mar 2020, at 20:26, Ben Greenman wrote: > >> But I was really expecting that the option -t in the racket command should >> replace the explicit (require…) in B.rkt. Something like >> >>> racket -t A.rkt -f B.rkt >> default-load-handler: expected a `module' declaration, but found something >> else > > Yes that almost works, but A.rkt needs to provide things for the > require to get them. > > Also, I guess we need --lib racket (maybe my -I racket was a mistake): > > racket --lib racket -t A.rkt -f B.rkt -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/418DF21E-53DA-4E66-B33C-416962E5D527%40gmail.com.
Re: [racket-users] Load and execute files
> But I was really expecting that the option -t in the racket command should > replace the explicit (require…) in B.rkt. Something like > >> racket -t A.rkt -f B.rkt > default-load-handler: expected a `module' declaration, but found something > else Yes that almost works, but A.rkt needs to provide things for the require to get them. Also, I guess we need --lib racket (maybe my -I racket was a mistake): > racket --lib racket -t A.rkt -f B.rkt -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAFUu9R6XQ_4wF%3DOFvA1SKsSLFf90wcg0rhUTyTuPVZKf-cDShg%40mail.gmail.com.
Re: [racket-users] Load and execute files
Oh… That is great Ben. Thank you. This is very closer to what I am looking for, so I can avoid having to add the (provide …) in A.rkt and (require …) in B.rkt !! I should not be so hard to remove the lines `#lang racket` in all files from the students. But I was really expecting that the option -t in the racket command should replace the explicit (require…) in B.rkt. Something like > racket -t A.rkt -f B.rkt default-load-handler: expected a `module' declaration, but found something else Best, Alexandre -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/805ED557-768A-4437-8123-3CF6E7F08549%40gmail.com.
Re: [racket-users] Load and execute files
On 3/19/20, Alexandre Rademaker wrote: > > Suppose I have some functions defined in a file A.rkt and some tests defined > in the file B.rkt. How can I execute the tests in the command line? > > I was expecting to be able to run > >> racket A.rkt B.rkt > > But this does not evaluate the expressions on B.rkt as I was expecting! > > 1. Do I need to export the functions in A.rkt with (provide …)? > 2. Do I need to add the (require …) in B.rkt? > > > The idea is to have the students submitting their A.rkt files and I could > test all of them using a single set of tests in another racket file. > > Ideas? What am I missing? If A.rkt contains a few expressions (and no #lang): ``` (define a 2) ``` and B.rkt contains a few expressions: ``` (unless (= 6 a) (error 'bad)) ``` then `racket -I racket --load a.rkt --load b.rkt` evaluates the expressions in A and then the expressions in B, as if they were all part of the same #lang racket file -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAFUu9R735FzZxd9p6mXNP-DFU-D5%3DhC-fpzaBuDAVGvGTTVHsA%40mail.gmail.com.