Recursion Part 1

Recursion is art of making programs call themselves. It is my opinion, recursion is the main idea in computer programming. In fact early computer theorist where recursion theorist( eg. church, curry, ackermann,etc). Recursion theory inspired functional programming in the 70s. Functional programming is prefered by these mathematically oriented programmers not only by its elagence but by it suitability to be reasoned with mathematically.

Lisp was invented by John Mccathy in 1958. It was also based in recursive theory paradigm. The language in my opinion possesess the beauty of the mathematics it inherited from. It has simple syntax(core language i mean). eg. only 5 primitive operations are defined: car,cdr,cons,eq, and null. Knowing these together with statements for creating functions(lamda or defun) and conditional statements(if, cond) one can derive everything else using the language. I am set to master lisp, not necessary to use as a language in my programming task, but you think though programming problems using lisp. I have recently learnt about programming abstractions, and I learnt that procedural languages like c,pascal, are no better than assembly language at abstracting from the machine language. A procedural language is theoretically describable in 3 constructs(iteration,sequence, and choice). But to me iterations and choice are just a fancy name for branch with condition(ie goto statement).

So structured programming(aka procedural programming) does not help much to hide the machine. Enter functional programming. Functions are a true abstraction that can hide complex turing/von-newmman complex mechanisms. The whole point of high level programming is to abstract away from details and think of a problem in terms of higher concept. Infact it can be argued the whole point of human intelligence comprise of this. So Programming language should hide low level complexity as much as possible. Mathematics, esp advanced mathematics, make use of this concept, although mathematicians are not aware of it. Calculus abstracts away from analytic definitions (reihmans sums and limit definitions) to work with functions algebraically. In fact theorems, are like programming language. With each and every general theorem, one can come with more general definitions which allows to work out programs more abstractly. Moving from number theory to vectors to tensors employs this process of abstraction. It is therefore important to abstract away from details and deal with more generic concepts. Novices shy away from generic concept hinting how difficult they are, but they don't realise that abstract concept are key to hiding complexity. These examples from mathematics are meant to highlight why functional programming is more suited to hiding complexity when it get down to programming, especially at the high level. In my next entry I will like to go on and talk more about recursion theory and how it can enhance our programming skills.

Comments

Popular posts from this blog

Back to programming competitons

Debugging Part 3