macros (or similar) in Maxima



Hi Stavros,

I guess there are two reasons: (1) I know CL so it was easier to reach
for the familiar, and (2) I am still developing my mental model of
Maxima and I need to wrap my head around the fact that being written in
CL does not make it CL.

BTW, Maxima is the first CAS I have ever used seriously, and the fact
that I can always drop to CL played a large role in choosing it.

Best,

Tamas

On Tue 10 Apr 2012 11:50:08 PM CEST, Stavros Macrakis wrote:

> Tamas,
> 
> I think Ray Toy's answer solves your problem.
> 
> But I'm curious to understand why you thought you needed to use Maxima
> macros rather than regular Maxima functions to solve this problem.  Also
> curious to understand why you went directly to Lisp rather than code in the
> Maxima language.
> 
> Perhaps some other computer algebra system you've used wasn't fully
> programmable?  or had macro semantics instead of function semantics?
> 
>               -s
> 
> On Tue, Apr 3, 2012 at 01:48, 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?
> >
> > This is how I attempted to do it (not with a macro, but by calling texput
> > directly):
> >
> > :lisp (flet ((texputall (prefix &key (latex prefix) (subscripts '("10"
> > "11" "20" "21" "22"))) (loop for subscript in subscripts do (mfuncall
> > '$texput (make-symbol (format nil "$~A~A" prefix subscript)) (format nil
> > "~A_{~A}" latex subscript))))) (loop for s in '("w" "W" "g") do (texputall
> > s)))
> >
> > but it didn't work (Lisp error: (void-function mfuncall)).
> >
> > 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.
> >
> > Best,
> >
> > Tamas
> >
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
> >
>