Function Documentation



On 8/13/2013 5:32 PM, Daniel Steinberg wrote:
> In Maxima, the describe function can get documentation for some 
> function. For example, "describe(abs)" returns documentation on the 
> abs function. Is there any way to define documentation for 
> user-defined functions? For example, if I have a function "foo", is 
> there any way to define a doc string such that describe(foo) would 
> return that string?
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima

I think it is not currently possible, but it would be very nice to have.

The current documentation setup is unfortunately kept rather separate
from the code that is read into memory by load() or batch().  This is
partly a relic of an earlier time when memory was a scarce resource,
and partly that the processing of text is being done by other programs
in a batch operation...  at least as far as I understand it. But
I haven't really tracked the various modifications of the routines.


Here's a way one might handle what you've suggested...
have a command, say
document(name,  "document string .... perhaps in html or TeX or ...");
that associates name with the documentation.

Add to describe(X) a preliminary search for document string(s) 
associated with X,
and then access the reference manual.

A nuance:  it could be that you would like to have describe(X) work even
if X has not been loaded in, yet.  In which case the doc string for X
would have to be stashed in or nearby the reference manual.

my thoughts, anyway..
RJF