aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2023-11-30 18:57:27 -0800
committercolin <colin@cicadas.surf>2023-11-30 18:57:27 -0800
commit6313c32898f155c44fff350aa18358be58483fd9 (patch)
tree87e95f7688a99310fb7f15064c6d8c84c42164bf
parenta7f9f52a100b8ba8ef87b93ce6e227f9238e2902 (diff)
rearrange arguments in defvalidator
-rw-r--r--README.org4
-rw-r--r--terrafirma.lisp2
2 files changed, 3 insertions, 3 deletions
diff --git a/README.org b/README.org
index 1f84171..4fe65a2 100644
--- a/README.org
+++ b/README.org
@@ -21,7 +21,7 @@ Here is an example:
;; defines a function called VALID-POINT-P. By default the name of the
;; type is used to create the validator function's name.
-(defvalidator (pt point)
+(defvalidator point (pt)
(validate (and (slot-boundp pt 'x) (slot-boundp pt 'y))
"Both X and Y must be bound.")
(with-slots (x y) pt
@@ -34,7 +34,7 @@ Here is an example:
;; defines a function called VALID-POLY-P. Here we pass a specific
;; name in. We also define this validator in terms of gthe
;; VALID-POLY-P validator.
-(defvalidator (p polygon :name valid-poly-p)
+(defvalidator polygon (p :name valid-poly-p)
(validate (slot-boundp p 'verts) "VERTS must be bound.")
(let ((verts (slot-value p 'verts)))
(validate (< 2 (length verts)) "VERTS must contain at least three points.")
diff --git a/terrafirma.lisp b/terrafirma.lisp
index b5ef90c..e5a3ec5 100644
--- a/terrafirma.lisp
+++ b/terrafirma.lisp
@@ -48,7 +48,7 @@
(defvar *type*)
(defvar *instance*)
-(defmacro defvalidator ((var type &key name) &body body)
+(defmacro defvalidator (type (var &key name) &body body)
"Defines a validation function. If TYPE is a symbolic type identifier,
then the defined function will have a name like VALID-<TYPE>-P.
Otherwise a NAME must be provided.