Browse Source

Add to-sexp for constants (handle resolution thereof)

Samuel W. Flint 5 years ago
parent
commit
84a326f5e7
1 changed files with 9 additions and 3 deletions
  1. 9 3
      larcs.org

+ 9 - 3
larcs.org

@@ -67,7 +67,7 @@ While the [[id:f3e3cdb9-a661-4598-8be1-e15f587f35bb][Introduction]] describes th
 #+TOC: headlines 3
 #+TOC: listings
 
-* WORKING Expression Types [0/4]
+* WORKING Expression Types [1/4]
 :PROPERTIES:
 :ID:       fe611e8f-db42-4fe0-8e77-9cfb55d2227c
 :END:
@@ -164,7 +164,7 @@ Note, by default, ~eqal~ will handle ~type-error~ by trying to switch the order
 [[file:img/types.png]]
 
 
-** WORKING Atomic Types [2/3]
+** DONE Atomic Types [3/3]
 :PROPERTIES:
 :ID:       9be57f5d-ed0e-4a7c-9c06-a4c647f6d56e
 :END:
@@ -242,7 +242,8 @@ CLOSED: [2019-01-16 Wed 16:13]
     (slot-value expression 'name))
 #+END_SRC
 
-*** WORKING Constants
+*** DONE Constants
+CLOSED: [2019-01-16 Wed 16:23]
 :PROPERTIES:
 :ID:       806bbce0-ab52-411a-8178-29bda6bbb36a
 :END:
@@ -281,6 +282,11 @@ Equality of constants is a bit different, and is checked as follows:
   (defmethod eqal ((expression-a <constant>) (expression-b <number>))
     (= (slot-value expression-a 'value)
        (slot-value expression-b 'value)))
+
+  (defmethod to-sexp ((expression <constant>) &optional resolve-constants-p)
+    (if resolve-constants-p
+        (slot-value expression 'value)
+        (slot-value expression 'name)))
 #+END_SRC
 
 ** WORKING Compound Types [0/7]