I'm sympathetic with the idea but there is an issue to note ...
On 1/20/2013 2:44 PM, Henry Baker wrote:
> I'd be happy with a relatively simplistic form of if-then-else expressions, which could do "simplifications"/transformations like this:
>
> a*(if ... then b else c) <=> (if ... then a*b else a*c)
>
> a+(if ... then b else c) <=> (if ... then a+b else a+c)
>
> etc.
(1/(x-1) * if x=1 then 1 else (x-1) presumably binds x to 1 during
the "then" clause to get..
if x=1 then 1/(1-1) else (x-1)/(x-1)
which, during simplification, has a division by zero.
I think it is important to somehow convey the knowledge implicit in the
condition testing to the branches.
Maybe we should even have a result ...
if x=1 then <divide by zero> else "1 unless x=1"
so that someone does not subsequently use the value "1" and set x=1.
The scope of variables that entirely disappear is troublesome. It would
presumably
be a bad situation to get an answer "0 unless gensym123=1"
RJF