Hacker News new | ask | show | jobs
by shriramkmurthi 3649 days ago
There's absolutely nothing in Pyret forcing you to write `where` blocks with immediate tests. You can also put your tests in a `check` block, which can float anywhere, and in another module.

What we find valuable is to write a _small_ number of _illustrative_ examples, which we call the “sweep”, that summarize the main behavior of the function. Think of it as essential, runnable documentation. When you come to a new codebase (including your own, six months later!), these help you quickly page back in what the function was supposed to do.

The sweep is also really useful for peer-review, which is another especially valuable technique in both education and industry. We have done some nice studies on its effectiveness: http://cs.brown.edu/~sk/Publications/Papers/Published/pcgfk-...