Menu ▾ ▴

#1575 substitution into conditional

open
nobody
Lisp Core (456)
5
2009-03-04
2009-02-01
No

(%i5) subst(x = 0, '(if x < 1 then 5 else log(x)));
log(0) has been generated.

Discussion

  • Robert Dodier

    Robert Dodier - 2009-03-04
    • labels: --> Lisp Core
     
  • Robert Dodier

    Robert Dodier - 2009-03-04

    Well, I think subst is just incidental here.

    There are actually a couple of interacting problems here.
    (1) Should branches of conditionals be simplified when the conditional expression is simplified?
    (2) Should errors be triggered in simplification?

    At present branches of conditionals are simplified, and errors are triggered in simplification (e.g. 1/0, log(0), gamma(0)).

    Either (1) or (2) or both could go the other way. My own preference is for (1) but not (2), i.e. continue to simplify branches, and prohibit errors in simplification.

    Given the current policies (1) and (2), the observed behavior is to be expected; I guess it's a misfeature but I don't know if it's accurate to call it a bug.

     
  • Robert Dodier

    Robert Dodier - 2009-03-04

    I guess there's actually (3) should relational expressions simplify to Boolean values (when possible), and (4) should conditional expressions in which conditions are literal true or false simplify to the appropriate branch.

    Current policy is neither (3) nor (4). I'm pretty sure I 'm in favor (3) and probably (4) as well.

     

Log in to post a comment.