[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Defining MACSYMA functions in LISP



Has anyone used the climax::DEFMFUN macro?  I assume it is used to
define many of the macsyma functions, but it's not documented.  For now,
I'm using the following local hack:

(defmacro 1mdefun0 (name arglist &body body)
  (let ((mname (intern (string-append "$" (string-upcase (string name)))
		       'climax)))
  `(progn
     (defprop ,mname T climax::translated)
     (defprop ,mname climax::$any climax::function-mode)
     (defprop ,mname '(climax::$fixed_num_args_function T) climax::mplist)
     (defun ,mname ,arglist
       ,@body))))

;; The following function can be invoked using asqrtb(x,x) in macsyma
(mdefun asqrtb (a b) (* a (sqrt b)))

I hope climax::DEFMFUN is more general.  I'd like to use it for writing,
among other things, a general "escape to lisp" routine.

Thanks,
Scott