Go functional

Informally, we could say that it’s harmless for a function to modify something that no one
else owns. – Graham Paul, On lisp

Hey all,

I consider myself very fortunate to have a good teacher for my principals of programming languages course. Though I started understanding what I was taught quite late. Plus my excursions helped me to learn some more which could not be taught in the course due to time constraints. Before I explain purpose of this post let me blabber some more. I recently went through the syllabi of some Indian Universities and I noticed one common thread – emphasis on Object Oriented Programming especially in Java. One obvious reason behind that is to encourage placement as IT companies will be more than happy to see a tailor made employee. I respect all the thinking behind this but I also want to question them that is this really helping students become better computer engineers?

One part of my PPL course was about different programming paradigms. Again fortunately my prof cared to give at least basics of other paradigms and I kinda got sold for this – Functional Programming. I started reading about it and then I read this article and my views changed a lot about how programming should be done

Can Your Programming Language do this?

Joel Spolsky, one of the founder of stackoverflow and author of the shared article is a renowned personality. He pretty much covers all cool aspects about functional programming. I don’t want to reiterate them but I want to share some of my own experiences/views with my adventures in this domain.

I use haskell – a purely functional programming language – to write programs of this style. So what difference ithas does make?

Firstly your concept of what is function changes drastically. I used to think that it is just writing everything in form of function. If I can deal with classes in OOP well then I can deal with this as well. But my (mis)conceptions were tweaked first by abhijeet sir and then changed completely after googling it enough. Only the one who has gone through these phases can understand the top quote.

Secondly, you can never compare 2 paradigms. I also had a chance to learn few basics about Prolog – a logical programming language. It again is completely different domain. So I can say that I have at least tasted a variety of programming styles. This changes your view to look at a problem completely. So I would say you should try these uncommon languages.

Third, your concepts about recursion and evaluation strategy (lazy or eager) are refined. Who knew perl could be used to write functional programs?

After blabbering so much finally why I am saying this all? After talking to some of my friends on same thing I thought it would be best to share my experiences/experiments in this domain in detail. Thus I choose haskell as the platform to demonstrate whatever codes I write for the purpose. Please check blog after every friday night for next couple of weeks if you want to follow this new thread as every friday night I will be posting newest article in this thread.

Till then see you next time,

– Payas



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s