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

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Jan 9 21:42:06 EST 2014

I sometimes have tests of the form

 (!test ...
        (eval! ....))

which can work with structures and types defined in the students'
programs.

I prefer to have students supply a `parse` function, which takes an
S-expression and produces an expression to pass to `interp`, so that we
only have to agree on concrete syntax. Sometimes I have students supply
an `interp-expr` wrapper on `interp`, which coerces the result from
`interp` to an S-expression (e.g., a number or 'function).

At Thu, 9 Jan 2014 14:10:38 -0800, John Clements wrote:
> 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
> 
> 
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users


Posted on the users mailing list.