Re: Standard Forth versus Python: a case study

2006-10-16 Thread Elizabeth D Rather
[EMAIL PROTECTED] wrote: > John you nailed it. I was a big forth fan in the mid-80s but it was > very clear that you either had to spend a lot of money on proprietary > systems or do it ALL yourself. Not having any money I was pleased to be > able to do it all but today, in the age of instant commu

Re: Standard Forth versus Python: a case study

2006-10-15 Thread [EMAIL PROTECTED]
John you nailed it. I was a big forth fan in the mid-80s but it was very clear that you either had to spend a lot of money on proprietary systems or do it ALL yourself. Not having any money I was pleased to be able to do it all but today, in the age of instant communication and collaboration, its n

Re: Standard Forth versus Python: a case study

2006-10-14 Thread jacko
Paddy wrote: > werty wrote: > > Apples/oranges ? programmers are making very little $$ today . > >Thats software ! No one is makin money on obsolete Forth , > > so why a comparisom ? > > > > Ultimately the best OpSys will be free and millions of lines of code > > obsoleted . Because n

Re: Standard Forth versus Python: a case study

2006-10-13 Thread Paddy
werty wrote: > Apples/oranges ? programmers are making very little $$ today . >Thats software ! No one is makin money on obsolete Forth , > so why a comparisom ? > > Ultimately the best OpSys will be free and millions of lines of code > obsoleted . Because no one can protect intellectu

Re: Standard Forth versus Python: a case study

2006-10-13 Thread B M
i hang my head in shame. On 10/12/06, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > At Thursday 12/10/2006 17:44, [EMAIL PROTECTED] wrote: > > > > > > fun median { > > > > > var x = 0. > > > > > while( *p++) { > > > > > if( (*p) > x) x = *p. > > > > > } > > > > > return x. > > > > >

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Fredrik Lundh
Gabriel Genellina wrote: > At Thursday 12/10/2006 17:44, [EMAIL PROTECTED] wrote: > >> > > > fun median { >> > > > var x = 0. >> > > > while( *p++) { >> > > > if( (*p) > x) x = *p. >> > > > } >> > > > return x. >> > > > } >> >> clearly, i've forgotten the definition of the median of a

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Gabriel Genellina
At Thursday 12/10/2006 21:54, Paul Rubin wrote: Gabriel Genellina <[EMAIL PROTECTED]> writes: > That explains all. Finding the median in an efficient way (that is, > without sorting the data first) isn't trivial, so your claim of "I can > do that using only one temp variable" was a bit surprisin

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Paul Rubin
Gabriel Genellina <[EMAIL PROTECTED]> writes: > That explains all. Finding the median in an efficient way (that is, > without sorting the data first) isn't trivial, so your claim of "I can > do that using only one temp variable" was a bit surprising... > BTW, the median is the value which sits just

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Gabriel Genellina
At Thursday 12/10/2006 17:44, [EMAIL PROTECTED] wrote: > > > fun median { > > > var x = 0. > > > while( *p++) { > > > if( (*p) > x) x = *p. > > > } > > > return x. > > > } clearly, i've forgotten the definition of the median of a list. to that i plead faulty memory. That explains a

Re: Standard Forth versus Python: a case study

2006-10-12 Thread [EMAIL PROTECTED]
Paul Rubin wrote: > Paul Rubin 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

Re: Standard Forth versus Python: a case study

2006-10-12 Thread John Doty
Juho Schultz wrote: > John Doty wrote: > >> The problem: >> >> I have a bunch of image files in FITS format. For each raster row in >> each file, I need to determine the median pixel value and subtract it >> from all of the pixels in that row, and then write out the results as >> new FITS files. >

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Juho Schultz
John Doty wrote: > The problem: > > I have a bunch of image files in FITS format. For each raster row in > each file, I need to determine the median pixel value and subtract it > from all of the pixels in that row, and then write out the results as > new FITS files. > This may be personal bias...

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Neil Cerutti
On 2006-10-12, Neal Bridges <[EMAIL PROTECTED]> wrote: > "John Doty" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > [snip] >> Here's a K&R C function I wrote almost 20 years ago. > [code snipped] > > John, 'man indent' right away! As far as I know, he just forgot to strip out the

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Neal Bridges
"John Doty" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [snip] > Here's a K&R C function I wrote almost 20 years ago. [code snipped] John, 'man indent' right away! -- Neal Bridges http://quartus.net Home of Quartus Forth for the Palm OS! -- http://mail.python.org/mailman/list

Re: Standard Forth versus Python: a case study

2006-10-12 Thread John Doty
Paul McGuire wrote: > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Paul McGuire wrote: >>> <[EMAIL PROTECTED]> wrote in message >>> news:[EMAIL PROTECTED] [snip] no sort() is needed to calculate the median of a list. you just need one temp var. >>>

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Neil Cerutti
On 2006-10-12, Paul Rubin wrote: > Tarjan discovered a guaranteed O(n) algorithm in the 1970's(?) Huhn! I thought Tarjan was just the big bad evil guy in Bard's Tale 2 who was creating eternal winter. I'm glad he also contributed to our stock of *useful* algorithms. -- Neil Cerutti We will no

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Paul McGuire
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Paul McGuire wrote: > >> My original question was in response to your post, that sort() wasn't >> required but only a temp variable. I am very interested in seeing your >> solution that does not require the data to b

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Paul Rubin
Paul Rubin writes: > Tarjan discovered a guaranteed O(n) algorithm in the 1970's(?) whose > operation is much different and quite complex. But all of these need > more than one temp var. See an algorithms book like CLRS or Knuth > for more info. Ehh, make that Blum, Fl

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Paul Rubin
"Paul McGuire" <[EMAIL PROTECTED]> writes: > My original question was in response to your post, that sort() wasn't > required but only a temp variable. I am very interested in seeing your > solution that does not require the data to be sorted. (This is not just an > academic exercise - given a

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Fredrik Lundh
Paul McGuire wrote: > My original question was in response to your post, that sort() wasn't > required but only a temp > variable. I am very interested in seeing your solution that does not require > the data to be > sorted. (This is not just an academic exercise - given a large historical

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Paul McGuire wrote: >> <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> > [snip] >> > >> > no sort() is needed to calculate the median of a list. >> > >> > you just need one temp var. >> > >> >> Ok, I'll bite. How do y

Re: Standard Forth versus Python: a case study

2006-10-12 Thread bearophileHUGS
Ian McConnell wrote: > > If you can use Psyco and your FITS lines are really long (well, maybe > > too much, the treshold if about >~3000 in my PC) you can use something > > like this instead the builtin timsort: > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/466330 > > (To compute the

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Fredrik Lundh
Peter Decker wrote: >> 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? no, it's a pointer to the current item in the list. -- http://mail.python.org/mailman/listinfo/python-l

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Peter Decker
On 12 Oct 2006 04:40:32 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > Paul Rubin writes: > > > fun median { > > > var x = 0. > > > while( *p++) { > > > if( (*p) > x) x = *p. > > > } > > > return x. > > > } > > > > I count two variables, p and x. >

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > hi Paul; well when this was a stats-class assignment (back when pascal > was popular :) i just stepped through the vector and compared it > > (pseudo-code) > > ptr p = [with values]. > > fun median { > var x = 0. > while( *p++) { >if( (*p) > x) x = *p. > } > retur

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Andrew Haley
In comp.lang.forth Paul Rubin wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: >> fun median { >> var x = 0. >> while( *p++) { >> if( (*p) > x) x = *p. >> } >> return x. >> } > I count two variables, p and x. Isn't this the maximum? Andrew. -- http:

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Paul Rubin
Paul Rubin 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 t

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Paul Rubin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > fun median { > var x = 0. > while( *p++) { > if( (*p) > x) x = *p. > } > return x. > } I count two variables, p and x. -- http://mail.python.org/mailman/listinfo/python-list

Re: Standard Forth versus Python: a case study

2006-10-12 Thread [EMAIL PROTECTED]
Paul McGuire wrote: > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > [snip] > > > > no sort() is needed to calculate the median of a list. > > > > you just need one temp var. > > > > Ok, I'll bite. How do you compute the median of a list using just a single > temp var? > > -- Pa

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Ian McConnell
[EMAIL PROTECTED] writes: > John Doty: >> Yes. The efficient exact algorithms for this problem use *partial* >> sorts. The Forth one from the FSL is of this class (although I know of >> two better ones for big arrays). But it's tough to beat the efficiency >> of the approximate histogram-based met

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Paul Rubin
Fredrik Lundh <[EMAIL PROTECTED]> writes: > >> Ok, I'll bite. How do you compute the median of a list using just > >> a single temp var? > > Well there's an obvious quadratic-time method... > > that does it without modifying the list? > > if you can modify the list, there are plenty of algorithm

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Fredrik Lundh
Paul Rubin wrote: >> Ok, I'll bite. How do you compute the median of a list using just a single >> temp var? > > Well there's an obvious quadratic-time method... that does it without modifying the list? if you can modify the list, there are plenty of algorithms that does it in expected O(n)

Re: Standard Forth versus Python: a case study

2006-10-11 Thread bearophileHUGS
[EMAIL PROTECTED] wrote: > no sort() is needed to calculate the median of a list. > you just need one temp var. Can you show some actual code? (There is the median of 5 algorithm too). Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Standard Forth versus Python: a case study

2006-10-11 Thread Paul Rubin
"Paul McGuire" <[EMAIL PROTECTED]> writes: > Ok, I'll bite. How do you compute the median of a list using just a single > temp var? Well there's an obvious quadratic-time method... -- http://mail.python.org/mailman/listinfo/python-list

Re: Standard Forth versus Python: a case study

2006-10-11 Thread Ben Finney
"werty" <[EMAIL PROTECTED]> writes: > Browsers . There will be 2 columns , one on left will be main/orig > but on the Right will have hyperlink result . This way ya dont have > to go back to compare ! side by side . > Text editors will also work this way . You will read orig in left > colu

Re: Standard Forth versus Python: a case study

2006-10-11 Thread werty
Apples/oranges ? programmers are making very little $$ today . Thats software ! No one is makin money on obsolete Forth , so why a comparisom ? Ultimately the best OpSys will be free and millions of lines of code obsoleted . Because no one can protect intellectual property , its simp

Re: Standard Forth versus Python: a case study

2006-10-11 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [snip] > > no sort() is needed to calculate the median of a list. > > you just need one temp var. > Ok, I'll bite. How do you compute the median of a list using just a single temp var? -- Paul -- http://mail.python.org/mailman/l

Re: Standard Forth versus Python: a case study

2006-10-11 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] wrote: > no sort() is needed to calculate the median of a list. > you just need one temp var. Of course. But for a short enough list, the builtin sort() method may be faster than an O(n) algorithm coded in Python.

Re: Standard Forth versus Python: a case study

2006-10-11 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > John Doty: > > Yes. The efficient exact algorithms for this problem use *partial* > > sorts. The Forth one from the FSL is of this class (although I know of > > two better ones for big arrays). But it's tough to beat the efficiency > > of the approximate histogram-based m

Re: Standard Forth versus Python: a case study

2006-10-11 Thread jacko
[EMAIL PROTECTED] wrote: > John Doty: > > Yes. The efficient exact algorithms for this problem use *partial* > > sorts. The Forth one from the FSL is of this class (although I know of > > two better ones for big arrays). But it's tough to beat the efficiency > > of the approximate histogram-based

Re: Standard Forth versus Python: a case study

2006-10-11 Thread bearophileHUGS
John Doty: > Yes. The efficient exact algorithms for this problem use *partial* > sorts. The Forth one from the FSL is of this class (although I know of > two better ones for big arrays). But it's tough to beat the efficiency > of the approximate histogram-based method the Python stats module > imp

Re: Standard Forth versus Python: a case study

2006-10-11 Thread John Doty
Paul Rubin wrote: > John Doty <[EMAIL PROTECTED]> writes: >> I have a bunch of image files in FITS format. For each raster row in >> each file, I need to determine the median pixel value and subtract it >> from all of the pixels in that row, and then write out the results as >> new FITS files. > >

Re: Standard Forth versus Python: a case study

2006-10-11 Thread Paul Rubin
John Doty <[EMAIL PROTECTED]> writes: > I have a bunch of image files in FITS format. For each raster row in > each file, I need to determine the median pixel value and subtract it > from all of the pixels in that row, and then write out the results as > new FITS files. I dunno what FITS is, but i

Standard Forth versus Python: a case study

2006-10-11 Thread John Doty
I realized that I have a little job on the table that is a fine test of the Python versus Standard Forth code availability and reusability issue. Note that I have little experience with either Python or Standard Forth (but I have much experience with a very nonstandard Forth). I've noodled arou