From: Rune Allnor on 25 May 2010 13:52 On 25 Mai, 19:22, Walter Roberson <rober...(a)hushmail.com> wrote: > Rune Allnor wrote: > > On 25 Mai, 17:39, Walter Roberson <rober...(a)hushmail.com> wrote: > > >> No functional difference in the assembly or machine code: the main > >> difference is that switch is easier for humans to read and code. > > > And that in itself is the reason why *humans* should stick with > > *human-readable* code. > > Previously you wrote, > "I have never heard of it before, and there is no reason why you > should have to deal with it. This was obsolete 40 years ago." > > It was _not_ obsolete 40 years ago: it is in active use internally in > any high performance language, and every serious programmer should know > the concept and know how and when to employ it. No. The serious programmer should only know how to express his ideas in a human-language-based compromise between human languages and machine code. I do not disagree that these kinds of things are important on the machine code level, but the only humans that need to know about these things are the fery few people who write compilers. > Human readable code is not the only criteria in programming: > circumstances can make performance more important than the ability of > the average reader to make sense of the code. Preformance is low down on the priority list: The main priority is that people understand what the program does. *If* a program's perfomance can be *measured* to the effect that it is too slow, then yes, something might have to be done to improve performance. But *only* when *measurements* indisputably show that the program is too slow. If that happens, chances are that one might well want to skip fortran alltogether, and work direcly in assembler, and take advantage of whatever idiosyncracies are relevant on the platform at hand. > Equivalent programming is often used in state machines -- which are > often used for "transaction programming" and are often used for > programming graphic user interfaces. > > What any particular person finds easy to read depends on the person's > experience; for example, LISP programmers swear by LISP, finding it > "easy to read" when others just see a lot of ))))) . Or was LISP too > "obsolete 40 years ago" ? I don't know. I have never seen lisp, except for the language someone told me was based on lisp that is used to configure emacs. > You like to throw around "obsolete for 40 years", but you have not > demonstrated a good grasp of the state of programming 40 years ago. > State-of-the-art programming 40 years ago was COBOL66, which (if memory > serves me correctly) did not even allow nested structures, and which > relied heavily on MODIFY statements to alter the meaning of code! OK, Fortran might *actually* have been obsolete 39 or 41 years ago; I take for granted that your memory regarding that aera is better than mine. It doesn't matter. No one born in the last five decades needs have anything whatsoever to do with fortran. Rune
From: dpb on 25 May 2010 13:52 Baalzamon wrote: > (sorry if this is a double post, I hit the wrong button) > Much thanks everybody for the helpful advice and comments. I shall > investigate the fortran specfic site for further help. Last couple of > questions. considering this loop, > DO 10 I=1, N > a(I)=b(I)/5 > 10 z(I)=a(I)**2 > Is the statement at the end label a part of the loop, I much thought it > is.... .... Yes, as noted earlier, the above is the same as if it were written DO 10 I=1, N a(I)=b(I)/5 z(I)=a(I)**2 10 CONTINUE --
From: dpb on 25 May 2010 14:08 James Tursa wrote: > "Baalzamon " <baalzamon_moridin(a)yahoo.com> wrote in message > <htgngo$3ig$1(a)fred.mathworks.com>... >> >> DO 10 I=1, N >> a(I)=b(I)/5 >> 10 z(I)=a(I)**2 >> Is the statement at the end label a part of the loop, I much thought >> it is.... > > Yes. The above is the same as: > > a(1:N) = b(1:N) ./ 5; > z(1:N) = a(1:N) .^ 2; > > James Tursa Which is the same as a(1:N) = b(1:N)/5.0 z(1:N) = a(1:N)^2 In F90 and later... :) Or, of course, if the arrays a and b are of size N then one can as in ML dispense w/ the subscript range expressions as well. --
From: Bruno Luong on 25 May 2010 14:30 dpb <none(a)non.net> wrote in message <hth3rh$baj$1(a)news.eternal-september.org>... > > Which is the same as > > a(1:N) = b(1:N)/5.0 > z(1:N) = a(1:N)^2 > Woah, I haven't programmed Fortran for a while, but the syntax looks neat. Bruno
From: dpb on 25 May 2010 14:47
Bruno Luong wrote: .... > Woah, I haven't programmed Fortran for a while, but the syntax looks neat. Neither has Rune, apparently... :) (Where "a while" seems to be something now approaching half of his "magic number" of 40 years :( ) -- |