# [racket] Writing type predicates in typed/racket

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