datatypes
It is implemented in the library, datatypes
to check the data type of the value.
returns |
|
returns |
|
returns |
|
returns |
|
returns |
|
returns |
|
returns |
|
returns |
isInt
or isInteger
Returns #T
(true) if the value is an integer.
isInt(Value)
isInteger(Value)
Where:
-
Value
is the value to be checked if it is an integer.
@library("dt:","datatypes").
anumber(123).
notanumber("abc").
result(X) :- anumber(Y), X = dt:isInt(Y).
result(Y) :- notanumber(X), Y = dt:isInt(X).
@output("result").
result(#T)
result(#F)
isDouble
Returns #T
(true) if the value is a double.
isDouble(Value)
Where:
-
Value
is the value to be checked if it is a double.
@library("dt:","datatypes").
anumber(123).
notanumber("abc").
result(X) :- anumber(Y), X = dt:isDouble(123.45).
result(Y) :- notanumber(X), Y = dt:isDouble("abc").
@output("result").
result(#T)
result(#F)
isString
Returns #T
(true) if the value is a string.
isString(Value)
Where:
-
Value
is the value to be checked if it is a string.
@library("dt:","datatypes").
notastring(123).
astring("abc").
result(X) :- astring(Y), X = dt:isString(Y).
result(Y) :- notastring(X), Y = dt:isString(X).
@output("result").
result(#T)
result(#F)
isBoolean
Returns #T
(true) if the value is a boolean.
isBoolean(Value)
Where:
-
Value
is the value to be checked if it is a boolean.
@library("dt:","datatypes").
aboolean(#T).
notaboolean("abc").
result(X) :- aboolean(Y), X = dt:isBoolean(Y).
result(Y) :- notaboolean(X), Y = dt:isBoolean(X).
@output("result").
result(#T)
result(#F)
isDate
Returns #T
(true) if the value is a date.
isDate(Value)
Where:
-
Value
is the value to be checked if it is a date.
@library("dt:","datatypes").
adate("2024-06-28").
notadate("abc").
result(X) :- adate(Y), X = dt:isDate(Y).
result(Y) :- notadate(X), Y = dt:isDate(X).
@output("result").
result(#T)
result(#F)
isSet
Returns #T
(true) if the value is a set.
isSet(Value)
Where:
-
Value
is the value to be checked if it is a set.
@library("dt:","datatypes").
aset({1, 2, 3}).
notaset("abc").
result(X) :- aset(Y), X = dt:isSet(Y).
result(Y) :- notaset(X), Y = dt:isSet(X).
@output("result").
result(#T)
result(#F)
isList
Returns #T
(true) if the value is a list.
isList(Value)
Where:
-
Value
is the value to be checked if it is a list.
@library("dt:","datatypes").
alist([1, 2, 3]).
notalist("abc").
result(X) :- alist(Y),X = dt:isList(Y).
result(Y) :- notalist(X),Y = dt:isList(X).
@output("result").
result(#T)
result(#F)
instanceOf
Returns #T
(true) if the value is of the datatype datatype
.
instanceOf(Value, "datatype")
Where:
-
Value
is the value to be checked. -
datatype
is the datatype to check against.
@library("dt:","datatypes").
aninstanceofint(123).
notaninstanceofint("abc").
result(X) :- aninstanceofint(Y), X = dt:instanceOf(Y, "integer").
result(Y) :- notaninstanceofint(X), Y = dt:instanceOf(X, "integer").
@output("result").
result(#T)
result(#F)