Constants

function CONSTANT-P : (object)
Return T iff the argument is a CycL constant
Single value returned satisfies BOOLEANP. 

function CONSTANT-EXTERNAL-ID : (constant)
Return the external id of CONSTANT.
CONSTANT must satisfy CONSTANT-P.
Single value returned satisfies CONSTANT-EXTERNAL-ID-P or is NIL. 

function CONSTANT-INTERNAL-ID : (constant)
Return the internal id of CONSTANT.
CONSTANT must satisfy CONSTANT-P.
Single value returned satisfies CONSTANT-INTERNAL-ID-P or is NIL. 

function CONSTANT-NAME : (constant)
Return the name of CONSTANT or :unnamed.
CONSTANT must satisfy CONSTANT-P. 

function FIND-CONSTANT : (name)
Return the constant with NAME, or NIL if not present.
NAME must satisfy STRINGP.
Single value returned satisfies CONSTANT-P or is NIL. 

function FIND-CONSTANT-BY-EXTERNAL-ID : (external-id)
Return the constant with EXTERNAL-ID, or NIL if not present.
EXTERNAL-ID must satisfy CONSTANT-EXTERNAL-ID-P.
Single value returned satisfies CONSTANT-P or is NIL. 

function FIND-CONSTANT-BY-INTERNAL-ID : (id)
Return the constant with internal ID, or NIL if not present.
ID must satisfy CONSTANT-INTERNAL-ID-P.
Single value returned satisfies CONSTANT-P or is NIL. 

function CREATE-CONSTANT : (name &optional external-id)
Return a new constant named NAME. Use EXTERNAL-ID if non-null, else create a new ID.
Single value returned satisfies CONSTANT-P. 

function FIND-OR-CREATE-CONSTANT : (name &optional external-id)
Return the constant with NAME if it exists, otherwise create it with EXTERNAL-ID.
Also, if it exists but has a null id, install EXTERNAL-ID on the constant.
NAME must satisfy STRINGP.
Single value returned satisfies CONSTANT-P. 

function RENAME-CONSTANT : (constant new-name)
Rename CONSTANT to have NEW-NAME as its name. The constant is returned.
CONSTANT must satisfy CONSTANT-P.
NEW-NAME must satisfy STRINGP.
Single value returned satisfies CONSTANT-P. 

function UNIQUIFY-CONSTANT-NAME : (name)
Return a unique, currently unused constant name based on NAME, which must be a valid constant name.
NAME must satisfy STRINGP.
Single value returned satisfies STRINGP. 

function REMOVE-CONSTANT : (constant)
Remove constant from the KB.
CONSTANT must satisfy CONSTANT-P.
Single value returned satisfies NULL. 

macro DO-CONSTANTS : ((var &optional (message "mapping Cyc constants")) &body body)
Iterate over all HL constant datastructures, executing BODY within the scope of VAR.
VAR is bound to each constant in turn.
MESSAGE is a progress message string. 

function CONSTANT-COUNT : ()
Return the total number of constants.
Single value returned satisfies INTEGERP. 

function VALID-CONSTANT-NAME-CHAR : (char)
Return T iff CHAR is a character which is allowed in a valid constant name.
CHAR must satisfy CHARACTERP.
Single value returned satisfies BOOLEANP. 

function VALID-CONSTANT-NAME : (string)
Return T iff STRING is a valid name for a constant.
Single value returned satisfies BOOLEANP. 

function CONSTANT-COMPLETE-EXACT : (string &optional start end)
Return a valid constant whose name exactly matches STRING.
Optionally the START and END character positions can be
specified, such that the STRING matches characters between the START and 
END range. If no constant exists, return NIL.
STRING must satisfy STRINGP.
START must satisfy FIXNUMP. 

function CONSTANT-COMPLETE : (prefix &optional case-sensitive? exact-length? start end)
Return all valid constants with PREFIX as a prefix of their name
When CASE-SENSITIVE? is non-nil, the comparison is done in a case-sensitive fashion.
When EXACT-LENGTH? is non-nil, the prefix must be the entire string
Optionally the START and END character positions can be
specified, such that the PREFIX matches characters between the START and 
END range. If no constant exists, return NIL.
PREFIX must satisfy STRINGP.
CASE-SENSITIVE? must satisfy BOOLEANP.
EXACT-LENGTH? must satisfy BOOLEANP.
START must satisfy FIXNUMP. 

function CONSTANT-APROPOS : (substring &optional case-sensitive? start end)
Return all valid constants with SUBSTRING somewhere in their name
When CASE-SENSITIVE? is non-nil, the comparison is done in a case-sensitive fashion.
Optionally the START and END character positions can be
specified, such that the SUBSTRING matches characters between the START and 
END range. If no constant exists, return NIL.
SUBSTRING must satisfy STRINGP.
CASE-SENSITIVE? must satisfy BOOLEANP.
START must satisfy FIXNUMP.