Hello,
At present the functions op and args barf on atoms.
I propose that op and args return false when the argument is an atom.
This change is intended to obviate the need to always test whether
the argument is an atom before calling op or args.
I looked at the commercial Macsyma documentation, but it didn't
say what op and args do when the argument is an atom.
Comments?
Robert Dodier
PS. Here is a patch:
--- comm.lisp 20 Apr 2006 14:31:45 -0000 1.14
+++ comm.lisp 7 May 2006 18:18:31 -0000
@@ -630,7 +630,7 @@
;;; These functions implement the Macsyma functions $op and $operatorp.
;;; Dan Stanger
-(defmfun $op (expr) ($part expr 0))
+(defmfun $op (expr) (if ($atom expr) nil ($part expr 0)))
(defmfun $operatorp (expr oplist)
(if ($listp oplist) ($member ($op expr) oplist) (equal ($op expr) oplist)))
@@ -909,8 +909,11 @@
(if (null (cdr e)) (merror "Argument to `last' is empty."))
(car (last e)))
-(defmfun $args (e) (atomchk (setq e (format1 e)) '$args nil)
- (cons '(mlist) (margs e)))
+(defmfun $args (e)
+ (if ($atom e) nil
+ (progn
+ (setq e (format1 e))
+ (cons '(mlist) (margs e)))))
(defmfun $delete n
(cond ((= n 2) (setq n -1))