Skip to main content

special-operator-p

special-operator-p Function

Syntax:

special-operator-p symbol ! generalized-boolean

Arguments and Values:

symbol—a symbol.

generalized-boolean—a generalized boolean.

Description:

Returns true if symbol is a special operator ; otherwise, returns false.

Examples:

(special-operator-p ’if) *! true* 
(special-operator-p ’car) *! false*
(special-operator-p ’one) *! false*

Exceptional Situations:

Should signal type-error if its argument is not a symbol.

Notes:

Historically, this function was called special-form-p. The name was finally declared a misnomer and changed, since it returned true for special operators, not special forms.

constantp

Expanded Reference: special-operator-p

Testing Common Special Operators

special-operator-p returns true if the given symbol names a special operator.

(special-operator-p 'if)
=> T

(special-operator-p 'let)
=> T

(special-operator-p 'quote)
=> T

(special-operator-p 'progn)
=> T

Regular Functions and Macros Return NIL

(special-operator-p 'car)
=> NIL

(special-operator-p 'defun)
=> NIL

(special-operator-p 'list)
=> NIL

Checking Several Standard Special Operators

The standard defines exactly 25 special operators. Here are a few more tests:

(special-operator-p 'setq)
=> T

(special-operator-p 'function)
=> T

(special-operator-p 'go)
=> T

(special-operator-p 'tagbody)
=> T

Non-Existent Symbols

(special-operator-p 'not-a-real-thing)
=> NIL