| Did you know ... | Search Documentation: |
| pce<-convert |
<-convert
provides access to type<-check,
the PCE type checking and conversion system. The first argument is the
object to be checked/converted. The second is the type that should be
met.
Equivalent to type<-check,
but generally more comfortable as this method will automatically
translate a type specification into a type
object.
The following example converts anything convertible to an integer to an integer:
convert_to_int(Any, Int) :-
get(@pce, convert, Any, int, Int).
After which
convert_to_int('78', X) ==> 78
convert_to_int(string('1992'), X) ==> 1992
convert_to_int(hello, X) fails
convert_to_int(100, X) ==> 100
<-check <-convert