Monday, March 26, 2007

"Is not the Title of a Book, AFAIK" is not the title of a book, AFAIK - Part I

It was too much for me to digest, the first time I encountered recursion. That was when I knew all the bits and bytes about GW-BASIC, an awesome language for the beginners at the time. BASIC allowed all the hacks that aren't possible with modern languages while providing very least of the structured programming constructs. Still, many people used BASIC and it was fairly adequate for not-so-impressive programs (usually written by the owner of a pc) a layman would have ever needed. It was a time when I could write a program to find all the permutations of a given set using a myriad of goto's pointing every here and there of the program. Yet it was so familiar and easy to write, although all the programming text that I came across said that's not the way to do it. Duh! who cares about those structure-worshiping authors. I can do it in fewer lines than they do!

However, that was history. Much later at some point in time, I switched the language that I use to program from BASIC to Pascal. Suddenly it all seemed so easy. Structured programming seemed to be the way to go. Recursion was so natural with Pascal procedures. I wondered why I didn't start programming in Pascal earlier than this...

This change in programming language alone was one of the reasons that made me to grasp recursion quite easily. You can call one procedure within itself. But, only if you make sure that your procedure stops recursing (calling itself) at some point, your program would really work. Recurse ad infinitum is something that we can never achieve in the limited time frame that we live in, no matter how fast the recursion is performed, albeit if pull together some alien technology from Stargate (SciFi) to build our computers.

Infinitely many recursion, though can not be used with computers, is used extensively in mathematics, for it only is a thought process that proving theorems are involved with. The most popular such usage would be induction. We show that some statement P(n) is true for some initial value of n, and for P(m+1) if P(m) is. As we have already proved that P(n) is true, from the second part of the proof, we have P(n+1), hence P(n+2), and hence P(n+3)... ad infinitum. It is preferred in mathematics to say for 'all n', instead of 'to infinity' due to certain technicalities, however. The basic idea is the same: apply the inductive statement over and over infinitely many times, you get all n.

Uh oh! I didn't notice that I wrote about a pageful of crap until I previewed the site just now. Original reason I started writing this post was to note down some self-referent statements that could be constructed using natural language. Being the way too technical low life I am, I got brainsick with the parallels of self-reference in computer languages. Thus I'd mark this post as part-I. I will follow up with a sequel soon...

Friday, March 23, 2007

To Blog or not to Blog

Alright, finally I made my mind up. I am going to start blogging yet again. Did I say "yet again"? Yes ofcourse...

Well, I had been maintaining a weblog the days I started programming seriously. I have been messing around with computers since I was in grade 6. But it was in the vacation of 8 months (?) or so I had after my O/L examination, that I took computing really seriously. All I did those days is looking for some clever way of writing a piece of software. So I made a note of things that I learn each day on a web diary. Mind you, those were the days that the word blog itself was yet to be invented. Writing programming stuff for a few months, anyone is destined to be bored with it. I am no exception; all work and no play makes dummy a dull boy! Besides, I had to prepare for my A/Ls the next two years. Hence that tech blog was long gone.

The next time I started blogging was when I was an intern at IFS. The whole purpose of that blog was to keep track of the work I did there. Since I did not maintain the industrial placement report, which was required to obtain my B.Sc., on a day to day basis, this blog kept the necessary information instead. Like many (almost all except for Nuwan and GL may be) other students, I wrote the report about a month after the training was ended, when the university asked us to submit it. This blog was hosted in MSN Spaces, and it served it's purpose very well. I had no idea of continuing that blog anyway.

Now, coming back to the present, I have started blogging yet again. This time, the content is going to be drastically different (at least I hope so) from my previous attempts at blogging. I may drop technical posts here and there, but I want it to be non-techy savy friendly this time.

So here we go...