constantp(expression) → boolean

The subroutine constantp takes an expression as argument and determines whether or not it is a constant. If the specified expression is a constant, constantp returns true>; otherwise, it returns false.

Call: constantp('a23') Exit: true Call: constantp('1989') Exit: true Call: constantp('3.14159') Exit: true Call: constantp('barack_obama') Exit: true Call: constantp('person.father') Exit: true Call: constantp('"The quick from fox & the lazy dog!"') Exit: true Call: constantp('X23') Exit: false Call: constantp('_') Exit: false Call: constantp('f(a,b)') Exit: false

A constant is a string of alphanumeric characters and underscores and periods beginning with a digit or a lower case letter or it is a string of printable ascii characters enclosed in double quotes. Note that, in the current implementation, there is no way of escaping double quotes in quoted strings. Note also that it is common practice not to use upper case letters in constants. (This is to allow translation to other implementations that are case-independent and do not distinguish upper and lower case letters).

Comments and complaints to genesereth@stanford.edu.