[racket] define-type sensitivity in plai + handin-server

From: John Clements (clements at brinckerhoff.org)
Date: Thu Jan 9 17:10:38 EST 2014

I’m firing up my handin server again, and I thought I’d ask whether I’m missing an obvious solution to a problem. Here’s the problem:

In order to test student functions, you need to supply inputs. Generally, these inputs are of types defined in the student program. One obvious problem is that you need to know exactly how to construct those values, either by specifying the names & arities of each variant or by simply giving them the define-type. I don’t see any way around that.

Beyond that, though, there’s the question of comparing the results. Specifically, the handin-server evaluates the expected results in the context of the checker and not of the student program, and that’s obviously important—students could otherwise hack in bogus constructor-like functions that always returned 0, so that all comparisons trivially succeeded. (Yes, I hope I’d notice that when inspecting for grading.) However, this makes it hard to directly compare the output of student functions.

Currently, I hand-roll mappings from student-types to s-expressions, customized for each assignment. That’s painful. What might be easier but would be less robust would be to display these to strings then read them again, as a “magic serialization.” I do note that while “display” is in the plai-typed language, I can’t see a way to convert it directly to a string, though I could hack that in, I suspect.

The big question: is there an easier way to do all this?

Many thanks,

John



Posted on the users mailing list.