Thursday, June 14, 2012
On the Freshness of Math
It all started with a rather naive question asked by my 14 year old cousin, "Which programming language should I learn?", and by instinct I blurted out, "C, then you move on to C++." In India, most schools follow this pattern. (However, during my undergrad days I had to face a monstrous task of learning 8-9 languages. Thanks to a misprint on the syllabus which said Programming Languages, instead of Programming Language!) It is then, that I started wondering if I had wasted my time writing "Hello World"s, sorting integers and implementing Poker in some silly languages from Tatooine.
Modern programming can be said to have begun with the machine language programs, followed by the assembly languges, which later developed in to languages like FORTRAN, COBOL, and the most interesting of them all, LISP. One thing to note here is that Lisp and Fortran were the trunks of two separate evolutionary trees, one rooted in math and one rooted in machine architecture. Lisp was not really designed to be a programming language. →McCarthy did eventually intend to develop a programming language in this sense, but the Lisp that they actually ended up with was based on something separate that he did as a theoretical exercise- an effort to define a more convenient alternative to the Turing Machine. As McCarthy said later,
"Another way to show that Lisp was neater than Turing machines was to write a universal Lisp function and show that it is briefer and more comprehensible than the description of a universal Turing machine. This was the Lisp function eval..., which computes the value of a Lisp expression.... Writing eval required inventing a notation representing Lisp functions as Lisp data, and such a notation was devised for the purposes of the paper with no thought that it would be used to express Lisp programs in practice."
What happened next was that, some time in late 1958, Steve Russell, one of McCarthy's grad students, looked at this definition of eval and realized that if he translated it into machine language, the result would be a Lisp interpreter. So the short explanation of why this 1950s language is not obsolete is that it was not technology but math, and math doesn't get stale. For a complete list of what made Lisp different see. McCarthy's 1960 paper, RECURSIVE FUNCTIONS OF SYMBOLIC EXPRESSIONS AND THEIR COMPUTATION BY MACHINE, is the original paper on Lisp. (Later, Prolog did stir up things a bit though.)
Paul Graham argues that there have been two really clean, consistent models of programming so far: the C model and the Lisp model. These two seem points of high ground, with swampy lowlands between them. As computers have grown more powerful, the new languages being developed have been moving steadily toward the Lisp model. Looking at these languages in order, Java, Perl, Python, one may notice an interesting pattern, that is, each one is progressively more like Lisp! Graham even claims that simple Lisp programs can be converted into Python line for line. [Bonus for staying with me this far: Write a Lisp Interpreter in Python!]
Isn't it interesting to note how some formal mathematical theory is being adopted by the mainstream consumerism? Stuff like Lambda Expressions are being re-acknowledged as being indispensable tools for easy data manipulation (like in C#/,Net). Now with the advent of multi-paradigm programming languages, things are all set to change, but not for things with strong mathematical background and formal definition. Only the feeble needs worrying!
Labels:
computer science,
lisp,
math,
mccarthy,
programming language
Subscribe to:
Post Comments (Atom)
Good little essay. But you should have mentioned Algol, the first and most influential of the block structured languages. And also, what is in my opinion clearly the best of them, Pascal.
ReplyDeleteGood little essay. But you should have mentioned Algol, the first and most influential of the block structured languages. And also, what is in my opinion clearly the best of them, Pascal.
ReplyDeleteoi Zubin, contact me ASAP..
ReplyDeletephne no. 8974205531
-Tim