Browse Source

`eqal`ity of divisions are done

Samuel W. Flint 5 years ago
parent
commit
c043bf3f72
1 changed files with 10 additions and 3 deletions
  1. 10 3
      larcs.org

+ 10 - 3
larcs.org

@@ -427,7 +427,7 @@ Equality of constants is a bit different, and is checked as follows:
        (slot-value expression-b 'value)))
 #+END_SRC
 
-** WORKING Compound Types [1/7]
+** WORKING Compound Types [2/7]
 
 Compound types are the majority of expressions.  An atom is well and good, but often says relatively little.  We use compound types to form equations from other expressions.  These are not, then, ~atomicp~.
 
@@ -461,9 +461,10 @@ Multiplication is one of the more frequently used expression types, and is, surp
                              :test #'eqal))))
 #+END_SRC
 
-*** WORKING Divisions
+*** DONE Divisions
+CLOSED: [2019-01-05 Sat 12:25]
 
-Division is similar to ~<multiplication>~, although instead of having ~terms~ it has ~numerator~ and ~denominator~.
+Division is similar to ~<multiplication>~, although instead of having ~terms~ it has ~numerator~ and ~denominator~.  A ~<division>~ is equal to another if the ~numerator~ of the first is ~eqal~ to the second and likewise for the denominator.
 
 #+Caption: Divisions
 #+Name: type-division
@@ -475,6 +476,12 @@ Division is similar to ~<multiplication>~, although instead of having ~terms~ it
      (denominator ::reader div-denominator
                   :initarg :denominator
                   :type <expression>)))
+
+  (defmethod eqal ((expression-a <division>) (expression-b <division>))
+    (and (eqal (div-numerator expression-a)
+             (div-numerator expression-b))
+       (eqal (div-denominator expression-a)
+             (div-denominator expression-b))))
 #+END_SRC
 
 *** WORKING Exponentials