[plt-scheme] No vector-of-functions contract?

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Jun 13 18:51:41 EDT 2008

Vectors are mutable. We don't know how to enforce contracts on  
mutable compound structures well, so we don't allow it.

On Jun 13, 2008, at 6:30 PM, Will Farr wrote:

> Hello all,
>
> I want to have the following provide form in some of my code:
>
> (provide/contract
>  (eta (matrix-of-dimensions/c 4 4))
>  (generators (vectorof (matrix-of-dimensions/c 4 4)))
>  (exp-generators (vectorof (-> real? (matrix-of-dimensions/c 4 4)))))
>
> Note the contract on exp-generators: a vector of functions.  Trying  
> to compile this code complains about
>
> vectorof: expected a flat contract or procedure of arity 1 as  
> argument, got: #<|->|>
>
> Is there any way to put a contract on this export more specific  
> than (vectorof procedure?)?  Is it just too hard to dig into the  
> vector and attach the appropriate higher-order contract to its  
> members?
>
> Thanks,
> Will
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.