|
@@ -453,7 +453,7 @@ Equality of constants is a bit different, and is checked as follows:
|
|
|
(slot-value expression-b 'value)))
|
|
|
#+END_SRC
|
|
|
|
|
|
-** WORKING Compound Types [5/7]
|
|
|
+** WORKING Compound Types [6/7]
|
|
|
:PROPERTIES:
|
|
|
:ID: a0d2eb19-8a1e-4dee-9b41-c454a49cacc4
|
|
|
:END:
|
|
@@ -497,6 +497,34 @@ CLOSED: [2019-01-05 Sat 16:00]
|
|
|
:test #'eqal)))))
|
|
|
#+END_SRC
|
|
|
|
|
|
+*** DONE Subtractions
|
|
|
+CLOSED: [2019-01-05 Sat 16:41]
|
|
|
+:PROPERTIES:
|
|
|
+:ID: aad16971-81c8-48da-aaa5-bb84b03d6912
|
|
|
+:END:
|
|
|
+
|
|
|
+Subtractions again, contain only a list of terms. However, unlike other types having only a list of terms, the terms are not a set, and therefore order as well as content must be verified to check ~eqal~-ness.
|
|
|
+
|
|
|
+#+Caption: Subtractions
|
|
|
+#+Name: type-subtractions
|
|
|
+#+BEGIN_SRC lisp
|
|
|
+ @export
|
|
|
+ (defclass <subtraction> (<compound>)
|
|
|
+ ((terms :reader terms
|
|
|
+ :initarg :terms
|
|
|
+ :type (list <expression>))))
|
|
|
+
|
|
|
+ (defmethod eqal ((expression-a <subtraction>) (expression-b <subtraction>))
|
|
|
+ (let ((a-terms (terms expression-a))
|
|
|
+ (b-terms (terms expression-b)))
|
|
|
+ (and (= (length a-terms)
|
|
|
+ (length b-terms))
|
|
|
+ (do* ((keep (eqal (first a-terms) (first b-terms)) (eqal (first a) (first b)))
|
|
|
+ (a a-terms (rest a))
|
|
|
+ (b b-terms (rest b)))
|
|
|
+ ((or (not keep) (null a) (null b)) keep)))))
|
|
|
+#+END_SRC
|
|
|
+
|
|
|
*** DONE Multiplications
|
|
|
CLOSED: [2019-01-05 Sat 12:17]
|
|
|
:PROPERTIES:
|
|
@@ -626,8 +654,6 @@ CLOSED: [2019-01-05 Sat 15:47]
|
|
|
|
|
|
*** TODO Trigonometric
|
|
|
|
|
|
-*** TODO Subtractions
|
|
|
-
|
|
|
** DONE Blended Types -- Polynomial Terms
|
|
|
CLOSED: [2019-01-05 Sat 09:46]
|
|
|
:PROPERTIES:
|
|
@@ -2053,6 +2079,7 @@ As all of the packages are defined centrally, this makes resolving inter-package
|
|
|
|
|
|
<<type-compound>>
|
|
|
<<type-additions>>
|
|
|
+ <<type-subtractions>>
|
|
|
<<type-multiplications>>
|
|
|
<<type-division>>
|
|
|
<<type-exponentials>>
|