On Tue, Apr 3, 2012 at 1:48 AM, Tamas Papp <tkpapp at gmail.com> wrote:
> Hi,
>
> Can I achieve the effect of
>
> texput(W10,"W_{10}")$
> texput(W11,"W_{11}")$
> texput(W20,"W_{20}")$
> texput(W21,"W_{21}")$
> texput(W22,"W_{22}")$
>
> texput(w10,"w_{10}")$
> texput(w11,"w_{11}")$
> texput(w20,"w_{20}")$
> texput(w21,"w_{21}")$
> texput(w22,"w_{22}")$
>
> texput(g10,"g_{10}")$
> texput(g11,"g_{11}")$
> texput(g20,"g_{20}")$
> texput(g21,"g_{21}")$
> texput(g22,"g_{22}")$
>
> with some kind of macro in Maxima?
>
How about this:
foo(var, n) := texput(concat(var, n), sconcat(var, "_{", n, "}));
foo(W,10)$
tex(W10); -> $$W_{10}$$
for index in [10, 11, 20, 21, 22] do foo(W,index);
> Generally, what's the best way to write (debug, etc) more complex CL
> constructs used in Maxima? I am using Emacs and I am familiar with
> SLIME, so it would be great if I could use it to write CL for Maxima
> somehow. It would be nice to get indentation in the code I write,
> also not being forced to put in on one line for :lisp.
>
Someone posted here a while ago about how to get maxima to work with
slime. I haven't done that in many years.
And I usually avoid writing in CL what I can do in maxima itself, although
some things are easier in CL. If you have a specific case in mind, please
share so that we can help.
For debugging I just use prints (formats) in my CL and maxima code. I also
start maxima with the -g option so that CL error drops me into the CL
debugger and I can use that as I would normally.
I never write anything important using :lisp. For that I just save it in a
file as I would with any lisp code and use load("dir/file.lisp") to load
it. If I want it compiled, I use :lisp to compile and load it.
Ray