Standard Forth versus Python: a case study

idknow at gmail.com idknow at gmail.com
Thu Oct 12 16:44:14 EDT 2006


Paul Rubin 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.

oops, i apologise, the > should be <
that's just a typo.

As for your quoting, you cut off the global var line and miscounted; p
is a global or from the caller of median()

also, i plead `too early in the morning to code properly' :)

clearly, i've forgotten the definition of the median of a list.
to that i plead faulty memory.

my apologises for coding at a bad hour.




More information about the Python-list mailing list