Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; imaxima.lisp and pdiff.lisp
- ;;
- ;; To reproduce:
- ;;
- ;; maxima
- ;; to_lisp();
- ;; (load "pdiff.lisp")
- ;;
- (in-package :maxima)
- (defmacro style-warning-suppressor (&rest body)
- (if (member :clisp *features*)
- (setq body (cons
- '(let ((scr (find-symbol "*SUPPRESS-CHECK-REDEFINITION*" :CUSTOM)))
- (if scr (set scr t)))
- body)))
- (if (macro-function 'handler-bind)
- `(handler-bind ((style-warning #'muffle-warning))
- ,@body)
- `(progn ,@body)))
- (style-warning-suppressor
- (defun memq (elem seq)
- #+(or cmu scl) (declare (inline member))
- (member elem seq :test #'eq))
- ) ;; This paran closes style-warning-suppressor.
- (defun pdiff-get-number-args (f)
- (let ((z (cdar (member f (cdr $functions) :key #'caar))))
- (cond ((and z (every #'symbolp z)) (length z))
- ((and (atom f) (or (trigp f) (arcp f) (memq f '(%log %gamma %erf %sqrt mabs)))) 1)
- ((memq f '($bessel_i $bessel_j $bessel_k $bessel_y)) 2)
- ((or (equal f "^") (equal f ".") (equal f "^^")) 2)
- ((and (op-equalp f 'lambda) (every #'symbolp (margs (second f))))
- ($length (second f)))
- ((and (symbolp f) (get f 'grad)) (length (first (get f 'grad))))
- ((eq t ($constantp f)) 'constant-function)
- (t nil))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement