[Newbie] problem with conditional expression



On 3/9/07, Robert Dodier <robert.dodier at gmail.com> wrote:
> Stavros, this looks to me like another example which shows users
> would benefit from having boolsimp merged into maxima/src.

I really do understand the motivation for manipulable conditional
expressions -- I've been advocating them for years (in fact, I think I
was the first to advocate them on this list).  I just don't think they
should be the same thing as programming conditionals, because they
will lead to perverse results, e.g.

      block([],
                 if x>3 then return(3),
                 5)

always returns 5 (assuming x is undefined) with no indication anything
was wrong.  I suppose you could resolve this case by giving an error
if an unevaluated conditional is returned in a side-effect-only
position, but I'm not sure that's the right thing either.

In fact, in general, I would like to be able to perform *partial
evaluation* on programs, but I don't want to do that by default.
Partial evaluation would make

      assume(zzz>3)

      for i thru zzz do p:p+i

return something like

      (p:p+6,
      for i from 4 thru zzz do p:p+1)

Very nice, but not something I want from my default evaluator.

           -s

 On 3/9/07, Hugo Coolens <coolens at kahosl.be> wrote:
> > I'm trying to define a function as follows:
> > f(t):= if (0<=t and t<t1) then -(A/t1)*t+A else 0;
> >
> > when trying out "f(0);" I get the error message....