[racket] Writing type predicates in typed/racket

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Sun Nov 7 11:13:35 EST 2010

On Sun, Nov 7, 2010 at 10:40 AM, Eric Dobson <endobson at cs.brown.edu> wrote:
> I ran a test and it looks like define-predicate is not constant time,
> is there a way for me to write branch? that is constant time?
> Otherwise a traversal algorithm turns from linear to quadratic.

So, it looks like TR is failing to prove that `pair?' is the same as
`branch?' on num-trees, which it should.  I'll look into that as well.

The easiest way to get constant time checks is to use structs - struct
predicates are always constant time.
-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.