Advertisement
Guest User

Untitled

a guest
May 1st, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. ;; imaxima.lisp and pdiff.lisp
  2. ;;
  3. ;; To reproduce:
  4. ;;
  5. ;; maxima
  6. ;; to_lisp();
  7. ;; (load "pdiff.lisp")
  8. ;;
  9.  
  10. (in-package :maxima)
  11.  
  12. (defmacro style-warning-suppressor (&rest body)
  13. (if (member :clisp *features*)
  14. (setq body (cons
  15. '(let ((scr (find-symbol "*SUPPRESS-CHECK-REDEFINITION*" :CUSTOM)))
  16. (if scr (set scr t)))
  17. body)))
  18. (if (macro-function 'handler-bind)
  19. `(handler-bind ((style-warning #'muffle-warning))
  20. ,@body)
  21. `(progn ,@body)))
  22.  
  23. (style-warning-suppressor
  24.  
  25. (defun memq (elem seq)
  26. #+(or cmu scl) (declare (inline member))
  27. (member elem seq :test #'eq))
  28.  
  29. ) ;; This paran closes style-warning-suppressor.
  30.  
  31. (defun pdiff-get-number-args (f)
  32. (let ((z (cdar (member f (cdr $functions) :key #'caar))))
  33. (cond ((and z (every #'symbolp z)) (length z))
  34. ((and (atom f) (or (trigp f) (arcp f) (memq f '(%log %gamma %erf %sqrt mabs)))) 1)
  35. ((memq f '($bessel_i $bessel_j $bessel_k $bessel_y)) 2)
  36. ((or (equal f "^") (equal f ".") (equal f "^^")) 2)
  37. ((and (op-equalp f 'lambda) (every #'symbolp (margs (second f))))
  38. ($length (second f)))
  39. ((and (symbolp f) (get f 'grad)) (length (first (get f 'grad))))
  40. ((eq t ($constantp f)) 'constant-function)
  41. (t nil))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement