An insight on functional programming

It has been a long vacation, with quite some events to talk about

I had been following up the release of F# CTP which I haven’t got comprehensive knowledge yet, but to sum it up, it is a functional, declarative programming language.

In a functional language, each function should get some inputs, and return an output, with no other “side effect”; which means the internal implementation of the function doesn’t affect the state of the object or the state of any other related objects or global variables.

This is what differs functional languages from procedural or object oriented languages where a “method” can affect the instance fields or properties of the same object and/or other objects, can print something on a screen, or can persist something on other media. Each of these action doesn’t qualify a language as a functional language.

Some “pure functions” are mathematical functions such as “SUM()”, “AVG()”, “MAX()”, “MIN()” which typically get one or more input and return an output regardless of the context it is called from.

That decoupling from the context, make it easy to define “what” instead of “how” and hence it is a declarative programming language as well.

You can get a quick understanding of this language and the concepts of functional languages from this 20 minutes tutorial.

Advertisements