[plt-scheme] box contract

From: John Clements (clements at brinckerhoff.org)
Date: Thu Jul 25 09:51:50 EDT 2002

At 3:22 PM -0400 7/24/02, Mike T. Machenry wrote:
>[Please handle PLT Scheme list administrative tasks through the Web:
>    http://list.cs.brown.edu/mailman/listinfo/plt-scheme]
>
>Is there a proper way to contract a box to be a specific type of box?
>
>;;i could easily contract it as such
>(provide/contract
>   (number-changer (box? . -> . void?)))
>
>;;this has more desirable expresability
>(provide/contract
>   (number-changer ((box-of number?) . -> . void?)))
>
>-mike

Mike, why not write the predicate yourself?  Viz:

(define (box-of pred)
   (lambda (x)
     (and (box? x)
          (pred (unbox x)))))


john





Posted on the users mailing list.