[plt-scheme] Dependent Contracts for Structures?

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Apr 7 12:21:23 EDT 2009

You might want to try "lazy data-structure contracts". See section in  
the contract chapter -- Matthias



On Apr 7, 2009, at 11:23 AM, Will M Farr wrote:

> Hello all,
>
> Is it possible to create "dependent" contracts (in the spirit of '- 
> >d) for structs in a provide/contract form?  I'm thinking something  
> like
>
> (struct matrix
>   ((rows natural-number/c)
>    (cols natural-number/c)
>    (elts (vector-of-length/c (* rows cols)))))
>
> When I try this now, I get that 'rows and 'cols are not bound in  
> the (vector-of-length/c ...) contract. I don't see anything about  
> this in the documentation for the (struct ...) form in (provide/ 
> contract ...).
>
> It's not really strictly necessary, but it would be nice to have....
>
> Thanks!
> Will
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.