For Programmers: Free Programming Magazines  


Home > Archive > Fortran > August 2005 > Re: Count Items challenge









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Count Items challenge
robin

2005-08-21, 6:57 pm


David Frank wrote in message ...
> [ ] scans a line once, and count the items in the line.
>
>OTOH, my Count_Items function in
>http://home.earthlink.net/~davegemini/strings.f90
>does just that.



It does?
It examines each character twice; that counts as two scans.


David Frank

2005-08-21, 6:57 pm


"robin" <robin_v@bigpond.com> wrote in message
news:nt1Oe.6467$FA3.726@news-server.bigpond.net.au...
>
> David Frank wrote in message ...
>
>
> It does?
> It examines each character twice; that counts as two scans.
>
>


Oh good grief, another cross-posting, WHY?
You think you have earth-shaking news to impart to Fortran'ers?

What does a scan (bla, bla, bla, i = 1,len(line)-1) mean to you?

Dont know? It means the index i advances linearly thru the line 1 time,
just as your Tally function marches linearly
examining each char multiple times depending on the len of the search
item.
similialy march thru checking yyy vs xxxxxx at each stage


James Giles

2005-08-21, 6:57 pm

David Frank wrote:
.....
> What does a scan (bla, bla, bla, i = 1,len(line)-1) mean to you?


To everyone but fools, it means that "bla, bla, bla" is
performed a particular number of times. If "bla, bla,
bla" references two different values of an array, and
those overlap with subsequent value of I, those values
of the array are scanned more than once. Everyone
knows this. The optimizer *may* be able to undo such
foolishness. But why not write it as you want it executed
in the first place?

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare


David Frank

2005-08-21, 6:57 pm


"James Giles" <jamesgiles@worldnet.att.net> wrote in message
news:AV5Oe.121451$5N3.85349@bgtnsc05-news.ops.worldnet.att.net...
> David Frank wrote:
> ....
>
> To everyone but fools, it means that "bla, bla, bla" is
> performed a particular number of times. If "bla, bla,
> bla" references two different values of an array, and
> those overlap with subsequent value of I, those values
> of the array are scanned more than once. Everyone
> knows this. The optimizer *may* be able to undo such
> foolishness. But why not write it as you want it executed
> in the first place?
>
> --
> J. Giles


I note you deleted my arg that his tally examines each char the len of the
search arg times,
why is that?

>
> "I conclude that there are two ways of constructing a software
> design: One way is to make it so simple that there are obviously
> no deficiencies and the other way is to make it so complicated
> that there are no obvious deficiencies." -- C. A. R. Hoare
>
>



James Giles

2005-08-21, 6:57 pm

David Frank wrote:
....
> I note you deleted my arg that his tally examines each char the len
> of the search arg times,
> why is that?


Because I'm not talking about what *his* does - I'm
talking about what *yours* does. He has never made
the blatantly false claim that *his* solution to a problem
was the same as mine, or any other such claptrtap. What
difference how many times *his* code scans the data? If
he never claimed *falsely* that it does so only once, he is
not being dishonest.

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare


David Frank

2005-08-21, 6:57 pm


"James Giles" <jamesgiles@worldnet.att.net> wrote in message
news:ub7Oe.121671$5N3.60003@bgtnsc05-news.ops.worldnet.att.net...
> David Frank wrote:
> ...
>
> Because I'm not talking about what *his* does - I'm
> talking about what *yours* does. He has never made
> the blatantly false claim that *his* solution to a problem
> was the same as mine, or any other such claptrtap. What
> difference how many times *his* code scans the data? If
> he never claimed *falsely* that it does so only once, he is
> not being dishonest.
>


Both my statement and his tally linearly scans thru the line ONCE REPEAT
ONCE
However his tally is called twice..



Rich Townsend

2005-08-21, 6:57 pm

David Frank wrote:
> "James Giles" <jamesgiles@worldnet.att.net> wrote in message
> news:ub7Oe.121671$5N3.60003@bgtnsc05-news.ops.worldnet.att.net...
>
>
>
> Both my statement and his tally linearly scans thru the line ONCE REPEAT
> ONCE
> However his tally is called twice..
>


...and you access each character of the line twice. I'd call that
scanning twice.

cheers,

Rich

James Giles

2005-08-21, 6:57 pm

Rich Townsend wrote:
....
> ..and you access each character of the line twice. I'd call that
> scanning twice.


So does everyone else. Only DF is so foolish as to believe
that he's fooling anyone.

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare


Tim Challenger

2005-08-22, 3:57 am

On Sun, 21 Aug 2005 20:58:08 GMT, James Giles wrote:

> J. Giles
>
> "I conclude that there are two ways of constructing a software
> design: One way is to make it so simple that there are obviously
> no deficiencies and the other way is to make it so complicated
> that there are no obvious deficiencies." -- C. A. R. Hoare



I hadn't heard that one before. :-)


--
Tim C.
Tim Challenger

2005-08-22, 3:57 am

On Sun, 21 Aug 2005 22:41:10 GMT, David Frank wrote:

> ... my statement ... linearly scans thru the line ONCE REPEAT ONCE


I think that's what James is trying to say. :-)
--
Tim C.
David Frank

2005-08-22, 7:57 am


"James Giles" <jamesgiles@worldnet.att.net> wrote in message
news:Am8Oe.649459$cg1.287174@bgtnsc04-news.ops.worldnet.att.net...
> Rich Townsend wrote:
> ...
>
> So does everyone else. Only DF is so foolish as to believe
> that he's fooling anyone.
>


I think everyone sees my do loop runs ONCE
at each column position it has a logical function to perform that involves
char access.

The challenge does not say that each char must be accessed only once,
it says "scan the line once"



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com