handling nil fix
This commit is contained in:
4
ml.cpp
4
ml.cpp
@@ -197,7 +197,7 @@ bool MlValue::is_list() const {
|
||||
}
|
||||
|
||||
bool MlValue::as_bool() const {
|
||||
return type != NIL;
|
||||
return !(type == NIL || (type == LIST && list.empty()));
|
||||
}
|
||||
|
||||
long MlValue::as_int() const {
|
||||
@@ -949,7 +949,7 @@ MlValue if_then_else(std::vector<MlValue> args, MlEnvironment &env) {
|
||||
else if (args.size() == 3)
|
||||
return args[2].eval(env);
|
||||
|
||||
return MlValue(0l);
|
||||
return MlValue::nil();
|
||||
}
|
||||
|
||||
// cond (SPECIAL FORM), in lisp it's macro, but we don't have support for macros yet
|
||||
|
||||
Reference in New Issue
Block a user