Post by David Richards
Hello All -
Trying to wrap my head around type specifiers and cannot figure out how to use
'member' in a compound type spec. If someone would kindly post a specific
example I would be very appreciative...
From the HyperSpec the MEMBER type specifier consists of a set of objects
which constitute the type. This is an explicit list of all of the actual objects that
make up the type. Symbols are unquoted in the set making up the members.
Some simple examples:
(typep 2 '(member 1 2 3)) ==> T
(typep 5 '(member 1 2 3)) ==> NIL
(typep 'b '(member a b c)) ==> T
(typep 'z '(member a b c)) ==> NIL
More complicated example:
(defstruct foo id)
(defvar *a* (make-foo :id "a"))
(defvar *b* (make-foo :id "b"))
;; Note the backquote on the first 2
(typep *a* `(member ,*a*)) ==> T
(typep *b* `(member ,*a*)) ==> NIL
(typep *a* '(member *a*)) ==> NIL (Because the struct is not the symbol '*a*)
So what are you trying to use MEMBER to express?