Browse Source

Update exponentials, adding to-sexp

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

+ 10 - 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 [4/7]
+** WORKING Compound Types [5/7]
 :PROPERTIES:
 :ID:       a0d2eb19-8a1e-4dee-9b41-c454a49cacc4
 :END:
@@ -428,7 +428,8 @@ Division is similar to ~<multiplication>~, although instead of having ~terms~ it
         ,(to-sexp (slot-value expression 'denominator) resolve-constants-p)))
 #+END_SRC
 
-*** WORKING Exponentials
+*** DONE Exponentials
+CLOSED: [2019-05-02 Thu 18:40]
 :PROPERTIES:
 :ID:       d8c87457-5c3b-4263-ba60-53b9b9f5e816
 :END:
@@ -453,6 +454,10 @@ There are two primary forms of exponential -- the natural (~exp~) and the genera
        (eqal (exponent expression-a)
              (exponent expression-b))))
 
+  (defmethod to-sexp ((expression <expt>) &optional resolve-constants-p)
+    `(expt ,(to-sexp (base expression) resolve-constants-p)
+           ,(to-sexp (slot-value expression 'exponent) resolve-constants-p)))
+
   @export
   (defclass <exp> (<expt>)
     ((exponent :reader exponent
@@ -463,6 +468,9 @@ There are two primary forms of exponential -- the natural (~exp~) and the genera
     (make-instance '<constant>
                    :name :e
                    :value 2.71828))
+
+  (defmethod to-sexp ((expression <exp>) &optional resolve-constants-p)
+    `(exp (to-sexp (slot-value expression 'exponent) resolve-constants-p)))
 #+END_SRC
 
 *** WORKING Logarithmics