some comments removed
This commit is contained in:
parent
16f9f93944
commit
cd8838c37d
8
ml.cpp
8
ml.cpp
|
|
@ -223,7 +223,6 @@ std::vector<MlValue> MlValue::as_list() const {
|
||||||
// Push an item to the end of this list
|
// Push an item to the end of this list
|
||||||
void MlValue::push(MlValue val) {
|
void MlValue::push(MlValue val) {
|
||||||
// If this item is not a list, you cannot push to it.
|
// If this item is not a list, you cannot push to it.
|
||||||
// Throw an error.
|
|
||||||
if (type != LIST)
|
if (type != LIST)
|
||||||
throw MlError(*this, MlEnvironment(), MISMATCHED_TYPES);
|
throw MlError(*this, MlEnvironment(), MISMATCHED_TYPES);
|
||||||
|
|
||||||
|
|
@ -233,7 +232,6 @@ void MlValue::push(MlValue val) {
|
||||||
// Push an item from the end of this list
|
// Push an item from the end of this list
|
||||||
MlValue MlValue::pop() {
|
MlValue MlValue::pop() {
|
||||||
// If this item is not a list, you cannot pop from it.
|
// If this item is not a list, you cannot pop from it.
|
||||||
// Throw an error.
|
|
||||||
if (type != LIST)
|
if (type != LIST)
|
||||||
throw MlError(*this, MlEnvironment(), MISMATCHED_TYPES);
|
throw MlError(*this, MlEnvironment(), MISMATCHED_TYPES);
|
||||||
|
|
||||||
|
|
@ -363,8 +361,6 @@ bool MlValue::operator<(const MlValue &other) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This function adds two lisp values, and returns the lisp value result.
|
|
||||||
MlValue MlValue::operator+(const MlValue &other) const {
|
MlValue MlValue::operator+(const MlValue &other) const {
|
||||||
if (other.type == NIL)
|
if (other.type == NIL)
|
||||||
throw MlError(*this, MlEnvironment(), INVALID_ARGUMENT_NIL);
|
throw MlError(*this, MlEnvironment(), INVALID_ARGUMENT_NIL);
|
||||||
|
|
@ -408,7 +404,6 @@ MlValue MlValue::operator+(const MlValue &other) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function subtracts two lisp values, and returns the lisp value result.
|
|
||||||
MlValue MlValue::operator-(const MlValue &other) const {
|
MlValue MlValue::operator-(const MlValue &other) const {
|
||||||
if (other.type == NIL)
|
if (other.type == NIL)
|
||||||
throw MlError(*this, MlEnvironment(), INVALID_ARGUMENT_NIL);
|
throw MlError(*this, MlEnvironment(), INVALID_ARGUMENT_NIL);
|
||||||
|
|
@ -435,7 +430,6 @@ MlValue MlValue::operator-(const MlValue &other) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function multiplies two lisp values, and returns the lisp value result.
|
|
||||||
MlValue MlValue::operator*(const MlValue &other) const {
|
MlValue MlValue::operator*(const MlValue &other) const {
|
||||||
if (other.type == NIL)
|
if (other.type == NIL)
|
||||||
throw MlError(*this, MlEnvironment(), INVALID_ARGUMENT_NIL);
|
throw MlError(*this, MlEnvironment(), INVALID_ARGUMENT_NIL);
|
||||||
|
|
@ -460,7 +454,6 @@ MlValue MlValue::operator*(const MlValue &other) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function divides two lisp values, and returns the lisp value result.
|
|
||||||
MlValue MlValue::operator/(const MlValue &other) const {
|
MlValue MlValue::operator/(const MlValue &other) const {
|
||||||
if (other.type == NIL)
|
if (other.type == NIL)
|
||||||
throw MlError(*this, MlEnvironment(), INVALID_ARGUMENT_NIL);
|
throw MlError(*this, MlEnvironment(), INVALID_ARGUMENT_NIL);
|
||||||
|
|
@ -485,7 +478,6 @@ MlValue MlValue::operator/(const MlValue &other) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function finds the remainder of two lisp values, and returns the lisp value result.
|
|
||||||
MlValue MlValue::operator%(const MlValue &other) const {
|
MlValue MlValue::operator%(const MlValue &other) const {
|
||||||
if (other.type == NIL)
|
if (other.type == NIL)
|
||||||
throw MlError(*this, MlEnvironment(), INVALID_ARGUMENT_NIL);
|
throw MlError(*this, MlEnvironment(), INVALID_ARGUMENT_NIL);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue