Menu

#4226 Lisp error for 'at(a, b)

None
open
nobody
at (6)
5
2023-12-28
2023-12-26
No

'at(a, b) provokes a Lisp error: "CAR: $B is not a list"

at(a, b) provokes a Maxima error: "at: improper argument: b"

I guess at is expecting the second argument to be an equation or a list of equations. That's great, so the Maxima error from at(a, b) is okay; the problem is that 'at(a, b) should likewise give a Maxima error, not a Lisp error.

Discussion

  • Gunter Königsmann

    while "improper argument" is correct we might be more specific here, too...

     
  • Tomio Arisaka

    Tomio Arisaka - 2023-12-28

    The function $AT is here:
    (an extract from "src/comm2.lisp")

    (defmfun $at (expr ateqs)
      (if (notloreq ateqs) (improper-arg-err ateqs '$at))
      (atscan (let ((*atp* t)) ($psubstitute ateqs expr)) ateqs))
    

    (if (notloreq ateqs) (improper-arg-err ateqs '$at)) checks the second argument of $AT, and shows the error message if necessary.

    On the other hand, the function SIMP-%AT does not have it as follows:

    (defprop %at simp-%at operators)
    
    (defun simp-%at (expr ignored simp-flag)
      (declare (ignore ignored))
      (twoargcheck expr)
      (let* ((arg (simpcheck (cadr expr) simp-flag))
             (e (resimplify (caddr expr)))
             (eqn (if ($listp e)
                      (if (= ($length e) 1) ($first e) (cons '(mlist simp) (cdr ($sort e))))
                      e)))
        (cond (($constantp arg) arg)
              ((alike1 eqn '((mlist))) arg)
              ((at-not-dependent eqn arg))
              (t (eqtest (list '(%at) arg eqn) expr)))))
    
     

Log in to post a comment.