Calling Maxima from Lisp (sbcl)



Dear developers,

This is an update to the post by Bruno Daniel found here:
http://article.gmane.org/gmane.comp.mathematics.maxima.general/17602

In order to work with the newer versions of Maxima (5.18.1) and SBCL (1.0.29),
the code suggested by Mr. Daniel should be changed slightly:

----------------------------------------------------------
(defpackage :my-package (:use :common-lisp))
(in-package :my-package)

(let ()
  (load "/Users/knutgj/Code/usemaxima/maxima-5.18.1/lisp-utils/defsystem.lisp")
;; This creates a lot of warnings in SBCL, but they seem to do no harm:
  (load "/Users/knutgj/Code/usemaxima/maxima-5.18.1/src/maxima.system")
  (funcall (intern (symbol-name :operate-on-system) :mk) "maxima" 
  :load :verbose t))


(let ()
  (setf maxima::*load-verbose* nil)
  (setf *debugger-hook* #'maxima::maxima-lisp-debugger)
  (let ((input-stream maxima::*standard-input*)
	(batch-flag nil))
    (progn
      (maxima::set-readtable-for-macsyma)
      (setf maxima::*read-default-float-format* 'double-float))
    (catch 'to-lisp
      (maxima::initialize-real-and-run-time)
      (intl::setlocale)
      (maxima::set-locale-subdir)
      (maxima::adjust-character-encoding)
      (maxima::set-pathnames)
      (when (boundp 'maxima::*maxima-prefix*)
	(push (pathname (concatenate 'string maxima::*maxima-prefix* "/share/locale/"))
	      intl::*locale-directories*))
      (setf (values input-stream batch-flag)
	    (maxima::process-maxima-args input-stream batch-flag))))
  )


(defparameter *maxima-package* (find-package :maxima))

(defun maxima::intern-invert-case (string)
  (intern (maxima::maybe-invert-string-case string) *maxima-package*))
-------------------------------------------------------------

The remainder of the code is so far unchanged (by me at least), only the
initialization of Maxima needed to be updated. I hope this helps others who wish
to use the features of Maxima from within their Lisp code.

Best regards,
Knut Gjerden