MlValue::is_string added

This commit is contained in:
2021-05-15 23:43:24 +02:00
parent fb25a7ea40
commit 08131d3e4e
2 changed files with 9 additions and 4 deletions

6
ml.cpp
View File

@@ -168,7 +168,7 @@ std::vector<std::string> MlValue::get_used_atoms() {
}
// Is this a builtin function?
bool MlValue::is_builtin() {
bool MlValue::is_builtin() const {
return type == BUILTIN;
}
@@ -176,6 +176,10 @@ bool MlValue::is_number() const {
return type == INT || type == FLOAT;
}
bool MlValue::is_string() const {
return type == STRING;
}
// Get the "truthy" boolean value of this value.
bool MlValue::as_bool() const {
return type != NIL && *this != MlValue(0l); // TODO remove 0 as false