Browse Source

Add in to-sexp for subtractions

Samuel W. Flint 5 years ago
parent
commit
af0d78b7ff
1 changed files with 7 additions and 2 deletions
  1. 7 2
      larcs.org

+ 7 - 2
larcs.org

@@ -289,7 +289,7 @@ Equality of constants is a bit different, and is checked as follows:
         (slot-value expression 'name)))
 #+END_SRC
 
-** WORKING Compound Types [1/7]
+** WORKING Compound Types [2/7]
 :PROPERTIES:
 :ID:       a0d2eb19-8a1e-4dee-9b41-c454a49cacc4
 :END:
@@ -337,7 +337,8 @@ CLOSED: [2019-01-17 Thu 09:53]
                   (slot-value expression 'terms))))
 #+END_SRC
 
-*** WORKING Subtractions
+*** DONE Subtractions
+CLOSED: [2019-01-17 Thu 10:01]
 :PROPERTIES:
 :ID:       aad16971-81c8-48da-aaa5-bb84b03d6912
 :END:
@@ -362,6 +363,10 @@ Subtractions again, contain only a list of terms.  However, unlike other types h
                (a a-terms (rest a))
                (b b-terms (rest b)))
               ((or (not keep) (null a) (null b)) keep)))))
+
+  (defmethod to-sexp ((expression <subtraction>) &optional resolve-constants-p)
+    `(- ,@(mapcar #'(lambda (exp) (to-sexp exp resolve-constants-p))
+                  (slot-value expression 'terms))))
 #+END_SRC
 
 *** WORKING Multiplications