Tamas Papp <tkpapp at gmail.com> writes:
> 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 doesn't need a macro. But, anyhow, buildq lets you write macros in
Maxima's own language.
>
> 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.
You can use slime to run both a CL top-level and a Maxima top-level from
the same Maxima lisp image.
Here is the configuration I use with an up-to-date Debian testing installation:
;; see http://common-lisp.net/pipermail/slime-devel/2009-December/017018.html
(defun load-swank-dont-close (port-filename encoding)
(format "%S\n\n"
`(progn
(load ,(expand-file-name slime-backend slime-path) :verbose t)
(funcall (read-from-string "swank-loader:init"))
(funcall (read-from-string "swank:start-server")
,port-filename
:coding-system ,(slime-coding-system-cl-name encoding)
:dont-close t))))
(defun slime-init-fn-msbcl ()
(insert "(in-package :maxima)\n(run)\n")
(comint-send-input))
(setq slime-lisp-implementations
'((maxima-sbcl
("sbcl" "--core" "/path/to/maxima/src/binary-sbcl/maxima.core")
:init-function slime-init-fn-msbcl
:env ("SBCL_HOME=/usr/lib/sbcl")
:init load-swank-dont-close
)))
The *slime* buffer ends up in the CL package, and the *inferior-lisp*
buffer is running a Maxima top level.
Note that there is a reader macro that lets you enter Maxima code from
the Lisp toplevel:
#$ x:1 $
--
Leo Butler <l_butler at users.sourceforge.net>
SDF Public Access UNIX System - http://sdf.lonestar.org