I’m pretty sure no, although such a type would be nice. If it’s a particular range like Byte, Index, Fixnum, or even something like Byte-Greater-Than-One or Index-that-is-not-a-Byte, then a type already exists, even if it’s not explicitly provided, but otherwise, I don’t think so.
You could use a union type, but I’m not sure if a large union type would work well in terms of performance? Otherwise you could use the closest super type and do the extra check at runtime. On Apr 20, 2015, at 9:09 PM, Benjamin Greenman <[email protected]> wrote: > The contract integer-in lets me guarantee an integer is within a certain > range. > > (define/contract (mod3 n) > (-> integer? (integer-in 0 2)) > (modulo n 3)) > > Is there a similar way to specify a type for an integer range? Or do I need > to use a union type? (I'd really like to specify a range containing over a > million integers.) > > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

