Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: -findname- updated on SSC
From
Nick Cox <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
RE: st: -findname- updated on SSC
Date
Fri, 16 Mar 2012 08:32:02 +0000
No strong disagreement with Daniel, and I guess he is joking at least in part, but a comment. I think the history of programming (and programming-like) languages shows that languages like FORTRAN (now Fortran) and C got it about right, as far as most people are concerned, in terms of a compromise between brevity and readability. In contrast, where are the longer-winded languages like COBOL now? Languages like APL (and now its successor J) are extremely concise and their programmers prize that, in some cases almost to the exclusion of other virtues, but they are cruelly cryptic to anyone other than those who program daily in them. I can remember that
+/ % #
is a complete program for taking means in J, but longer programs written in similar style are really hard work to read.
Here's a test for you: how do you abbreviate -generate-?
You could go down to -g- but I have rarely seen that. (I think Austin Nichols likes -g-.) Roger Newson likes -gene-, but then he started out as a biologist-. Lots of people like -gen- and my guess is that is the way even experienced Stata users like to remind ourselves of what the language is.
It is really important that programming is a social activity. You need to understand your own programs for a start, and to understand other programs that you use -- certainly that you modify. So, in practice reading and understanding speed are helped by avoiding minimal abbreviations, and I don't think, long run, that typing speed is what drives what I write.
Nick
[email protected]
daniel klein
If you do something, do it right. Change
program fg
version 9
findname `0'
end
which needs about 38-39 keyboard-hits (depending on whether ` is a
dead-key character) to be written, to
pr f
findname `0'
end
that only needs 21! -findname- will check the version for you. This
way you can save approximately 1/1000 ms each time from the moment you
use -f- instead of -findname- for the 22nd time. With the additional
17/1000 ms saved writing the program you will have plenty of time to
figure out an even faster solution. However, the problem with this
approach might be that -f- takes that 1/1000 ms saved typing to call
-findname-.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/