瀏覽代碼

`eqal`ity of divisions are done

Samuel W. Flint 7 年之前
父節點
當前提交
c043bf3f72
共有 1 個文件被更改,包括 10 次插入3 次删除
  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)))
        (slot-value expression-b 'value)))
 #+END_SRC
 #+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~.
 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))))
                              :test #'eqal))))
 #+END_SRC
 #+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
 #+Caption: Divisions
 #+Name: type-division
 #+Name: type-division
@@ -475,6 +476,12 @@ Division is similar to ~<multiplication>~, although instead of having ~terms~ it
      (denominator ::reader div-denominator
      (denominator ::reader div-denominator
                   :initarg :denominator
                   :initarg :denominator
                   :type <expression>)))
                   :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
 #+END_SRC
 
 
 *** WORKING Exponentials
 *** WORKING Exponentials