CL-USER> (documentation 'power 'function)
and it just returned NIL but as you can see from the list above given by apropos, power exists!
The symbol power
exists, but note that it's not bound
or fbound
like some of the other symbols are. Thus is doesn't have a function or value binding. Lots of symbols exist, even if they don't have a function or value binding. This can be particularly frustrating in apropos
, because if you do (apropos 'name)
, then in reading the form, you've already ensured that there's a symbol name
. Sometimes you'll see people use the uninterned symbol notation to avoid this problem. E.g.:
CL-USER> (apropos 'this-already-got-interned)
THIS-ALREADY-GOT-INTERNED
; No value
CL-USER> (apropos '#:but-this-didnt\!)
; No value
However, even if power
did have a function or value binding, there's no guarantee that there'd be documentation available for it. Note that the documentation for documentation
says:
Documentation strings are made available for debugging purposes. Conforming programs are permitted to use documentation strings when they are present, but should not depend for their correct behavior on the presence of those documentation strings. An implementation is permitted to discard documentation strings at any time for implementation-defined reasons.
That said, you can still try, and sometimes you'll get useful results:
CL-USER> (apropos '#:expt)
EXPT (fbound)
SB-C::EXPT-DERIVE-TYPE-AUX (fbound)
SB-C::EXPT-DERIVE-TYPE-OPTIMIZER (fbound)
...
; No value
CL-USER> (documentation 'expt 'function)
"Return BASE raised to the POWER."
In general, if you want to know more about an object, you can use describe
(sds pointed this out before I did). The output isn't specifically defined, but it may well include the documentation:
CL-USER> (describe 'expt)
COMMON-LISP:EXPT
[symbol]
EXPT names a compiled function:
Lambda-list: (BASE POWER)
Declared type: (FUNCTION (NUMBER NUMBER) (VALUES NUMBER &OPTIONAL))
Documentation:
Return BASE raised to the POWER.
Source file: SYS:SRC;CODE;IRRAT.LISP
; No value
In general, these tools can be useful, but if you're looking for a particular function to achieve some task, Google is probably going to be more helpful unless you've already got a good idea of what you're looking for. After all, the first result in a Google search for “common lisp hyperspec exponent power” is a link to the page for expt
.