How to add in maxima my own lisp-function as native?



???? ????? wrote:
> Greetings to all participant of this mail list.
> I'm Russian student and I make some scientific work. Part of this work 
> - it's to add in Maxima some lisp-functions and make it works. I don't 
> know lisp excellent, but I know lisp enough for my purposes; I 
> compiled Maxima from source successfully also. I've added in 
> src/comm.lisp (there were many source lisp-files - I've just 
> suggested, that "comm" means "common") for test my own lisp function 
> and called it my_function. This function have been available now; but 
> user should run it like that:
> :lisp (my_function $x);
> And result, of course, will be shown in lisp-style.
> So, my question is: there are a way to add some function, which was 
> written at Lisp, in Maxima, but this function must run and show result 
> not in Lisp-style? Such as like that:
> my_function(x);

You can do something like (defun $my_function (x) ...).  Then in maxima 
my_function(x) will work.
Or you could also do ?my_function(x).  The "?" before my_function means 
to call the Lisp function that is literally named my_function.

For the return value, you need to make your lisp function return forms 
in the right way.  Perhaps the simplest way is to type in the desired 
expression to maxima.  Then use :lisp $%onnn to look at how maxima 
represents it.  So x+1 is ((mplus) $x 1).

> And how better to extend Maxima by my own functions? I mean, in what 
> file in src/ should I add my own lisp-functions?
If they're not part of maxima,  would recommend that you put them some 
where else.  A good place would be the same directory as maxima_init is 
located.  Or just add the directory to file_search_maxima (and friends).

> I will be appreciate for any information about my questions; I also 
> will be glad to get from you any links to documentation and articles, 
> which dedicated to this. But I better prefer material, where author 
> give real example of adding lisp-function in Maxima, but without 
> lisp-style call of this function.

You might look at share/lbfgs  for some examples.  Or 
src/numerical/slatec/quadpack.lisp.
There are lots of other examples.

Ray