[plt-scheme] instanceof equivalent in Typed Scheme?
On Tue, Jun 9, 2009 at 2:59 PM, Todd O'Bryan<toddobryan at gmail.com> wrote:
> Is there a way to check whether something is of a particular type?
First-order values such as numbers come with predicates built-in, such
as `number?'. Structs define their own predicate.
For more complicated types, you can write functions with types like this:
> (: Type? : Any -> Boolean : Type)
for some types, but not all types, both because some such predicates
are not computable, as Matthias points out, and some cannot be
verified by Typed Scheme.
There isn't a general mechanism for defining such predicates.
--
sam th
samth at ccs.neu.edu