[plt-scheme] contracts in teaching languages

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Oct 6 21:31:36 EDT 2009

Just read 2htdp/universe.ss

(Robby has been working on this for a while. This is a seriously non- 
trivial problem, with a research component. The DeinProgram version of  
HtDP supports it already, though they use a serious hack and worst,  
the docs are in German.)

On Oct 6, 2009, at 8:55 PM, Todd O'Bryan wrote:

> I want to try having students use real, honest-to-goodness contracts,
> just to see how it goes. I'm just about to cover booleans and
> predicates, so I think it's a good time to give it a go.
> I think I'm also ready to try writing a macro, so I want to do  
> something like:
> (define/c (foo arg1 arg2 arg3)
>  (pred1? pred2? pred3? -> ret-pred?)
>  body)
> and have that convert to:
> (define/contract (foo arg1 arg2 arg3)
>  (-> pred1? pred2? pred3? ret-pred?) ; equivalently (pred1? pred2?
> pred3? . -> . ret-pred?)
>  body)
> One concern is that the reader in BSL gets upset by functions in
> argument positions, but I know there's a way around that, because the
> universe teachpack lets you specify handlers: (on-tick mod-world),
> etc.
> So, can somebody explain how I'd let my re-written contract fly under
> the BSL parser's radar? Obviously, if I get this working, I'll let
> people know how well--or badly--it works.
> Todd
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.