X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Futils.lisp;h=dff2ab02ac52a9f0a35c73bdddd2eb951b67af7d;hp=12d5d286b5024116360e92a9319adc688a7136db;hb=b50166ae0ba2bc09a9094c0e675ec92010b7293e;hpb=566670ff665e99a1774e0899a02ecde2d62b99cc diff --git a/sql/utils.lisp b/sql/utils.lisp index 12d5d28..dff2ab0 100644 --- a/sql/utils.lisp +++ b/sql/utils.lisp @@ -455,6 +455,12 @@ removed. keys are searched with #'MEMBER" (symbol (find-class it)) (standard-object (class-of it)))) +(defun to-class-name (o) + (etypecase o + (symbol o) + (standard-class (class-name o)) + (standard-object (class-name (class-of o))))) + (defun easy-slot-value (obj slot) "like slot-value except it accepts slot-names or defs and returns nil when the slot is unbound" @@ -466,3 +472,8 @@ removed. keys are searched with #'MEMBER" "like slot-value except it accepts slot-names or defs" (setf (slot-value obj (to-slot-name slot)) new)) +(defun delist-if-single (x) + "if this is a single item in a list return it" + (if (and (listp x) (= 1 (length x))) + (first x) + x))