Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Common Lisp: How to check if something is a type specifier?

I have been unable to find any built-in method of checking if something is a valid type specifier.

Does such a predicate exist?

(I would make one myself, but alas, the consequences of passing something not a type specifier to typep are undefined. And check-type has no exceptional situations according to the hyperspec.)

like image 417
Dragon Avatar asked Apr 09 '18 02:04

Dragon


1 Answers

You could use Tomohiro Matsuyama's trivial-types system (LLGPL), which among other things defines a wrapper around some implementation-specific predicates:

(defun type-specifier-p (type-specifier)
  "Returns true if TYPE-SPECIFIER is a valid type specfiier."
  (or (documentation type-specifier 'type)
      #+sbcl (sb-ext:valid-type-specifier-p type-specifier)
      #+openmcl (ccl:type-specifier-p type-specifier)
      #+ecl (c::valid-type-specifier type-specifier)))
like image 147
coredump Avatar answered Sep 17 '22 01:09

coredump