As discussed in #25, this is a few additions that will serve two purposes:
Allow automatic file detection, optionally. This is achieved by having two forms for define-var: the one that already existed, and a new one (define-var var-name). The latter relies upon finding a file with a known extension, defaulting to .rkt but configurable with set-autodetect-extension!.
Make it easier to test without using Docker. This is just a matter of letting the output & input be a bit more configurable (so you don't need stuff to be in /autograder).
I did not change the README, though obviously if this is merged, it should be documented there!
The eventual goal (and, I think with just these changes, it'll be enough for me) is to have this be a published package that I can depend on, rather than copying files / maintaining forks.
The diff algorithm has somewhat made a mess of things; the only real change to define-var is to change the macro to use syntax-parse so that the from base-filename can be optional (otherwise, there are just a few things that were extracted to variables). I'm sure there is a better way of writing that, and I'm happy if one of you who knows better wants to change it! With that, the bfn / filename can be chosen based on which version of the macro was invoked, and the rest of the code is unchanged.
One thing: I did not make the same change to mirror-macro. I started to, but it seemed like the code was bitrotted: the example in the README doesn't run (the file has the wrong name, but even after that is fixed, it gives the error Loading failed with error\nadd-one: undefined;\n cannot reference an identifier before its definition\n in module: \"/autograder/submission/code.rkt\"), so I wasn't sure the status of it. Regardless, it should be pretty trivial to do the same sort of transformation to it as I did for define-var.
As discussed in #25, this is a few additions that will serve two purposes:
define-var
: the one that already existed, and a new one(define-var var-name)
. The latter relies upon finding a file with a known extension, defaulting to.rkt
but configurable withset-autodetect-extension!
./autograder
).I did not change the README, though obviously if this is merged, it should be documented there!
The eventual goal (and, I think with just these changes, it'll be enough for me) is to have this be a published package that I can depend on, rather than copying files / maintaining forks.
The diff algorithm has somewhat made a mess of things; the only real change to
define-var
is to change the macro to usesyntax-parse
so that thefrom base-filename
can be optional (otherwise, there are just a few things that were extracted to variables). I'm sure there is a better way of writing that, and I'm happy if one of you who knows better wants to change it! With that, thebfn
/filename
can be chosen based on which version of the macro was invoked, and the rest of the code is unchanged.One thing: I did not make the same change to
mirror-macro
. I started to, but it seemed like the code was bitrotted: the example in the README doesn't run (the file has the wrong name, but even after that is fixed, it gives the errorLoading failed with error\nadd-one: undefined;\n cannot reference an identifier before its definition\n in module: \"/autograder/submission/code.rkt\"
), so I wasn't sure the status of it. Regardless, it should be pretty trivial to do the same sort of transformation to it as I did fordefine-var
.