|
@@ -53,7 +53,7 @@ As a part of my lisp-based Computer Algebra System, an algebraic manipulation to
|
|
|
#+TOC: headlines 3
|
|
#+TOC: headlines 3
|
|
|
#+TOC: listings
|
|
#+TOC: listings
|
|
|
|
|
|
|
|
-* WORKING Expression Typing [4/6]
|
|
|
|
|
|
|
+* WORKING Expression Typing [5/6]
|
|
|
:PROPERTIES:
|
|
:PROPERTIES:
|
|
|
:CREATED: <2016-04-30 Sat 23:15>
|
|
:CREATED: <2016-04-30 Sat 23:15>
|
|
|
:ID: c6921b1e-d269-4243-acff-5a77685c331e
|
|
:ID: c6921b1e-d269-4243-acff-5a77685c331e
|
|
@@ -144,12 +144,15 @@ To completely classify an expression, the ~*classifications*~ alist is mapped ov
|
|
|
(push name classifications))))))
|
|
(push name classifications))))))
|
|
|
#+END_SRC
|
|
#+END_SRC
|
|
|
|
|
|
|
|
-** WORKING Classification Case
|
|
|
|
|
|
|
+** DONE Classification Case
|
|
|
|
|
+CLOSED: [2016-05-30 Mon 18:17]
|
|
|
:PROPERTIES:
|
|
:PROPERTIES:
|
|
|
:CREATED: <2016-05-20 Fri 14:15>
|
|
:CREATED: <2016-05-20 Fri 14:15>
|
|
|
:ID: 19a4e467-baa0-47eb-9267-93ff3801b1fd
|
|
:ID: 19a4e467-baa0-47eb-9267-93ff3801b1fd
|
|
|
:END:
|
|
:END:
|
|
|
|
|
|
|
|
|
|
+Following the case pattern, and to allow for cleaner code, I've defined the classification case macro. It does this by taking a variable name and a list of cases. These are then mapped over, producing clauses suitable for a ~cond~ expression, to which this macro finally expands, binding the complete classification of the given expression to ~the-classification~.
|
|
|
|
|
+
|
|
|
#+Caption: Classification Case
|
|
#+Caption: Classification Case
|
|
|
#+Name: classification-case
|
|
#+Name: classification-case
|
|
|
#+BEGIN_SRC lisp
|
|
#+BEGIN_SRC lisp
|
|
@@ -161,8 +164,9 @@ To completely classify an expression, the ~*classifications*~ alist is mapped ov
|
|
|
`((classified-as-p ,var '*) ,@body)
|
|
`((classified-as-p ,var '*) ,@body)
|
|
|
`((classified-as-p ,var ',type) ,@body))))
|
|
`((classified-as-p ,var ',type) ,@body))))
|
|
|
cases)))
|
|
cases)))
|
|
|
- `(cond
|
|
|
|
|
- ,@conditions)))
|
|
|
|
|
|
|
+ `(let ((the-classification (classify ,var)))
|
|
|
|
|
+ (cond
|
|
|
|
|
+ ,@conditions))))
|
|
|
#+END_SRC
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** WORKING Classifications [7/13]
|
|
** WORKING Classifications [7/13]
|