true and nil can be casted to string now

This commit is contained in:
vaclavt 2022-01-10 20:25:57 +01:00
parent d275be643c
commit 990d75cf7a
1 changed files with 4 additions and 0 deletions

4
ml.cpp
View File

@ -287,6 +287,10 @@ MlValue MlValue::cast_to_string() const {
return MlValue::string(std::to_string(stack_data.f));
case STRING:
return *this;
case TRUE:
return MlValue::string("#t");
case NIL:
return MlValue::string("nil");
default:
throw MlError(*this, MlEnvironment(), BAD_CAST_STRING);
}