Standard Forth versus Python: a case study
Peter Decker
pydecker at gmail.com
Thu Oct 12 08:45:43 EDT 2006
On 12 Oct 2006 04:40:32 -0700, Paul Rubin
<"http://phr.cx"@nospam.invalid> wrote:
> Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:
> > > fun median {
> > > var x = 0.
> > > while( *p++) {
> > > if( (*p) > x) x = *p.
> > > }
> > > return x.
> > > }
> >
> > I count two variables, p and x.
>
> Also, that finds the maximum, not the median. I had stopped examining
> it after seeing it used more than one variable.
Um... isn't 'p' the list in question? There is only one variable used
for the calculation of the return value (yes, it's a maximum), and
that's 'x'.
--
# p.d.
More information about the Python-list
mailing list