diff --git a/ml.cpp b/ml.cpp index a89eb13..098c5e9 100644 --- a/ml.cpp +++ b/ml.cpp @@ -223,7 +223,6 @@ std::vector MlValue::as_list() const { // Push an item to the end of this list void MlValue::push(MlValue val) { // If this item is not a list, you cannot push to it. - // Throw an error. if (type != LIST) throw MlError(*this, MlEnvironment(), MISMATCHED_TYPES); @@ -233,7 +232,6 @@ void MlValue::push(MlValue val) { // Push an item from the end of this list MlValue MlValue::pop() { // If this item is not a list, you cannot pop from it. - // Throw an error. if (type != LIST) throw MlError(*this, MlEnvironment(), MISMATCHED_TYPES); @@ -294,7 +292,7 @@ bool MlValue::operator==(MlValue other) const { // other to a float, and then compare for equality. if (type == FLOAT && other.type == INT) return *this == other.cast_to_float(); else if (type == INT && other.type == FLOAT) return this->cast_to_float() == other; - // If the values types aren't equal, then they cannot be equal. + // If the values types aren't equal, then they cannot be equal. else if (type != other.type) return false; switch (type) { @@ -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 { if (other.type == 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 { if (other.type == 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 { if (other.type == 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 { if (other.type == 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 { if (other.type == NIL) throw MlError(*this, MlEnvironment(), INVALID_ARGUMENT_NIL);