I'm completely new to CL, and I'd like to learn how to read documentation strings and get other help information from the REPL. Something like help(symbol)
in Python, or symbol?
in iPython, or :t
and :i
in Haskell's GHCi.
So, given a symbol name, I'd like to be able to know:
- what kind of value it is bound to, if any (a function, a variable, none at all)
- if it is a function or a macro, then what are its positional arguments
- if it has a docstring, show it
- what package or file it is coming from or when it was defined
I found there is (documentation '_symbol_ '_type_)
, but it is not exactly what I need. I need to know the type of value the symbol is bound to ('function
, 'variable
, 'compiler-macro
, etc.) before I can use documentation
. Then it returns only the docstring, it may be missing or not sufficient to use the symbol.
For example, in Lisp, the help for mapcar
is not very useful (CLisp's REPL):
> (documentation 'mapcar 'function)
NIL
I'd like to be able to see something like this instead:
>>> map?
Type: builtin_function_or_method
Base Class: <type 'builtin_function_or_method'>
String Form: <built-in function map>
Namespace: Python builtin
Docstring:
map(function, sequence[, sequence, ...]) -> list
Return a list of the results of applying the function to the items of
the argument sequence(s). If more than one sequence is given, the
function is called with an argument list consisting of the corresponding
item of each sequence, substituting None for missing values when not all
sequences have the same length. If the function is None, return a list of
the items of the sequence (or a list of tuples if more than one sequence).