aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils.lisp
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-06-30 09:29:28 -0500
committerColin Okay <colin@cicadas.surf>2022-06-30 09:29:28 -0500
commit98b5811d8b50d20f8c15e9b202f0d3f0457df58b (patch)
tree6562850bbd01236cac901208d528ca2dacf83dc0 /src/utils.lisp
parent642c0c594a8abe05be1cb887110ed3e602cd0e48 (diff)
[modify] affine fns are generic; [add] safe-slot util
Diffstat (limited to 'src/utils.lisp')
-rw-r--r--src/utils.lisp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils.lisp b/src/utils.lisp
index e0f6dcd..3598ec3 100644
--- a/src/utils.lisp
+++ b/src/utils.lisp
@@ -7,3 +7,10 @@
(defun radians (degrees)
"Converse DEGREES to radians"
(* degrees +pi-over-180+))
+
+(defun safe-slot (object slot &optional default)
+ (if-let (val (and (slot-exists-p object slot)
+ (slot-boundp object slot)
+ (slot-value object slot)))
+ val
+ default))