Browse Source

Update definition of evaluate

Samuel W. Flint 5 years ago
parent
commit
2940b53d37
1 changed files with 9 additions and 1 deletions
  1. 9 1
      larcs.org

+ 9 - 1
larcs.org

@@ -108,7 +108,15 @@ Note that ~eqal~ will handle ~type-error~ by trying to switch the order of the a
   (defgeneric substitute-expression (replace replacement expression))
 
   @export
-  (defgeneric evaluate (expression &key substitutions-list resolve-constants-light-p resolve-constants-hard-p))
+  (defgeneric evaluate (expression substitutions-list &key resolve-constants-light-p resolve-constants-hard-p))
+
+  (defmethod evaluate :around (expression substitutions-list &key resolve-constants-light-p resolve-constants-hard-p)
+    (if (and (or resolve-constants-light-p
+              resolve-constants-hard-p)
+           (not (and resolve-constants-light-p
+                 resolve-constants-hard-p)))
+        (call-next-method)
+        (error "Only one of `resolve-constants-light-p' and `resolve-constants-hard-p' may be selected.")))
 
   @export
   (defgeneric to-sexp (expression &optional resolve-constants-p))