charfun



The function charfun (defined in nummod) makes a call to $ev:

  (setq bool (mevalp (mfuncall '$ev e '$nouns))).

I think the intent is to allow (ugly looking) things like

  charfun('"and"(-1 < x, x < 1))

to work. Would it be OK to change simp-charfun to something like

;; Side effects and errors are trouble makers...
;; Maybe the simplifya stuff should be moved inside the dolist.

(defun simp-charfun (e bool z)
  (let (($prederror nil) (acc `(($set))))
    (setq e (mapcar #'(lambda (s) (simplifya (specrepcheck s) z)) (margs
    e)))
    (catch 'done
      (dolist (ei e)
     (setq bool (mevalp ei))
     (cond ((eq bool nil)
            (throw 'done 0))
           ((not (eq bool t)) (setq acc ($adjoin ei acc)))))
      (throw 'done (if ($emptyp acc) 1 `(($charfun simp) ,@(margs
      acc)))))))

Then

(%i1) p : charfun(x > 0, x < 1);  <-- implied "and" (standard in set
builder notation)
(%o1) charfun(x>0,x<1)
(%i2) subst(x=2/3,p);
(%o2) 1

A few things in share/numeric/interpol could be simplified with this
change, I think.
A smarter charfun would know that charfun(x>0,x<0) = 0...

Barton