[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DEFSTRUCT and predicates



	
    Date: Tue, 26 Nov 1985  18:27 EST
    From: Skef Wholey <Wholey@C.CS.CMU.EDU>
    To:   NGALL@BBNG.ARPA
    Subject: DEFSTRUCT and predicates
    In-Reply-To: Msg of 26 Nov 1985  17:20-EST from NGALL at BBNG.ARPA
    Message-ID: <WHOLEY.12162427138.BABYL@C.CS.CMU.EDU>
    
	Date: Tuesday, 26 November 1985  17:20-EST
	From: NGALL at BBNG.ARPA
    
	The only complexity in the CL "-P" heuristic is dealing with qualified
	predicates such as string-(lessp).  Since defstruct created predicates
	will ALWAYS be suffixing data-type names (NEVER existing predicate
	names), defstruct can safely use the simple hyphenation heuristic,
	i.e., if the data-type name is hyphenated, add "-P", otherwise add
	"P".  Can anyone think of counter-examples?
    
    How about:
    
    (defstruct person
      mom
      dad
      kids
      shoe-size)
    
    (defstruct (space-person (:include person))
      planet-of-birth
      number-of-eyes)
    
    Space-Person-P (or Space-Personp) is what you call a "qualified predicate."
    
Hmmm.  I think I disagree.  I don't think Space-Person-P falls under
the CL definition of "qualified predicate":

1. The rationale for for NOT hyphenating the "P" in "STRING-LESSP" is
that it would "incorrectly imply that it is a predicate that tests for
a kind of object called a STRING-LESS."  This is exactly what we WANT
to imply in the case of SPACE-PERSON; so the predicate should be
SPACE-PERSON-P.

2. Your definition by example would require that SIMPLE-STRING-P
become SIMPLE-STRINGP, BIT-VECTOR-P become BIT-VECTORP, etc., since
STRINGP, VECTORP, etc., are already predicates.

3. In my opinion, the only predicates that retain their
"P"s "as is" are predicates such as lessp, greaterp, equalp, i.e.,
non-type-predicates.  And these are the kind of predicate that
defstruct will never have to deal with.

	-- Nick