Browse Source

Wrote to-sexp for additions

Samuel W. Flint 5 years ago
parent
commit
3afaea6160
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 [0/7]
+** WORKING Compound Types [1/7]
 :PROPERTIES:
 :ID:       a0d2eb19-8a1e-4dee-9b41-c454a49cacc4
 :END:
@@ -307,7 +307,8 @@ Compound types are the majority of expressions.  An atom is well and good, but o
     nil)
 #+END_SRC
 
-*** WORKING Additions
+*** DONE Additions
+CLOSED: [2019-01-17 Thu 09:53]
 :PROPERTIES:
 :ID:       a1a01fb4-59e1-4459-9ab9-d32269af77dd
 :END:
@@ -330,6 +331,10 @@ Compound types are the majority of expressions.  An atom is well and good, but o
             (length terms-b))
          (null (set-difference terms-a terms-b
                                :test #'eqal)))))
+
+  (defmethod to-sexp ((expression <addition>) &optional resolve-constants-p)
+    `(+ ,@(mapcar #'(lambda (exp) (to-sexp exp resolve-constants-p))
+                  (slot-value expression 'terms))))
 #+END_SRC
 
 *** WORKING Subtractions