
Re: Mathematica and Lisp
Posted:
Jan 18, 2013 12:50 AM


I did debate with myself whether to include efficiency in the desiderata for a first exposure to programming. Had I included it, it might have been expressed like this:
(12) Considering how memory and time constraints affect the programming approach.
Another possible item could be "elegance"  whatever that is. But I had hoped that points (2)(7), which address what one might call "clarity" would suffice in that direction.
On Jan 16, 2013, at 11:15 PM, David Bailey <dave@removedbailey.co.uk.math.umass.edu> wrote:
> On 16/01/2013 06:39, Murray Eisenberg wrote: >> >> >> >> It all depends on just what you want somebody to accomplish when learning his/her first programming language. > This is, of course, the key. However, I would hope that at least some > students will continuw to emerge with an understanding of what goes on > at the bottom level  otherwise we are getting cut off from the roots of > a vital technology. >> >> I've thought about that a lot over the some 30 years that I taught FORTRAN, Pascal, APL, J, and Mathematica in university math courses. (My very first programming language was Assembly for a Univac I, followed shortly by octalcoded machine instructions for a papertape input computer, and then FORTRAN II  all while I was an undergraduate. A decade later, BASIC, APL, Pascal; subsequently, J and Mathematica. Even later, a smattering of C, Perl, Python, Java. I've even dabbled a tiny bit with Forth and Snobol.) >> > Wow  you sound a bit like me, I didn't touch Perl, Forth, APL, or > Python (except to discover I hated them), but I did a lot with LISP and > Prolog, and a few more obscure languages  Algol 68, and Coral! > >> So what is essential for a first exposure to programming? To me, the essentials are: >> >> (0) Understanding carefully what the problem is, including what is given and what is to be found. >> >> (1) Identifying the objects (data) and what is to be done with them (operations, functions, procedures). >> >> (2) Breaking up a larger problem into its constituent parts. >> >> (3) Isolating the big ideas from the smaller technical points. >> >> (4) Expressing things within the constraints of a precise syntax. >> >> (5) Suitably modularizing the code in accordance with (2) and (3). >> >> (6) Making the code readable through judicious choice of names along with sufficient but nonredundant comments. >> >> (7) Making the code maintainable  by the original author or others. >> >> (8) Being able to test and debug the code. >> >> (9) For numerical work, understanding and coping with roundoff and other errors due to the limitations of finite precision. >> >> (10) Recognizing when and knowing how to code an operation repetitively  whether explicitly (iteratively or recursively) or implicitly (functionally). >> >> (11) Recognizing when and knowing how to express conditionals (whether via an explicit If, Which, etc., or instead as is possible in Mathematica, separate definitions of the same function for different cases). >> >> Must the firstlanguage learner get closer what s/he is "asking the computer to do" than might be the case with Mathematica? If so, how should you reasonably decide how deep to descend? (If you don't know what the ultimate actual binary code is, how could you know what the computer is _actually_ doing?) >> >> My experience, in fact, is that the higher the language level  such as that possible with Mathematica or APL or J  then the easier it is to master these essentials. All too often I have seen students unable to ascend to effective programming with a higherlevel language if their minds were rotted by the first exposure being to too lowlevel a language. (And that is despite my personal learning path that ascended from the ridiculous to the sublime.) >> > I used to work in compiler development, so I have been right down to the > bitlevel in a very serious way. However, even that isn't the end > nowadays, because computers contain hidden layers of microcode, etc. For > example, the 32bit Intel architecture has been largely the same across > many processors over the years, while the insides have changed radically. > > Your list is fine, but it doesn't seem to address the issue of code > efficiency. For some areas, this is vital (and for others it is > irrelevant), and it is not uncommon for someone to test out an idea on a > small dataset, without any realisation that it will not scale well to > real world problems. Sometimes that is a question of the choice of > algorithm, but Mathematica has a lot of subtle issues (such as not > Appending to long lists) that aren't true in other languages. Also rules > like "functional constructs are more efficient", are only true because > of the way Mathematica is implemented  they are not universal truths. > > David Bailey > http://www.dbaileyconsultancy.co.uk
 Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 5491020 (H) University of Massachusetts 413 5452838 (W) 710 North Pleasant Street fax 413 5451801 Amherst, MA 010039305

