programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger)
Subject: programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger)
From: Mario Rodriguez
Date: Sun, 07 Jan 2007 09:09:09 +0100
El s?b, 06-01-2007 a las 18:27 -0700, Robert Dodier escribi?:
> On 1/6/07, Richard Fateman <fateman at cs.berkeley.edu> wrote:
>
> > Also, be aware that op() takes a fair amount of time and space,
> > since it formats its argument.
>
> If op is a bottleneck for many programs, we should work on
> speeding up nformat then. Better than than to tell every user
> to use a more obscure alternative.
>
> > Else case(inpart(expr,0),
> > ["+", yyy],
> > ["*", zzz],
> > [otherwise, ...])
>
> I'm not opposed to having a case statement, but I don't like
> constructs that don't distinguish the different parts.
> I don't think a list of 2-element expressions has anything to
> recommend it, except it would be easy to implement.
>
> Better would be something more explicit like
>
> FOO (expr, case "+" : yyy, case "*" : zzz, otherwise : ...)
I vote for something like
case(expr,
"+", xxx,
"*", yyy,
otherwise, zzz)
There are other situations in Maxima ('depends', for example) where the
meaning of an argument depends on its position in the arguments list.
--
Mario Rodriguez Riotorto
www.biomates.net