Despite the bad weather condition we had eighteen people who showed up for the Functional Programming meetup organized by the Mauritius Software Craftsmanship Community.

The presentation was done by Renghen Pajanilingum. He had a session on “Programming Paradigms” during the Developers Conference 2017. Alas, a lot of people missed that session. Those who attended, however, asked if there could be a meetup dedicated to Functional Programming. I triggered the discussion on the MSCC’s meetup page and had a word with folks at the Turbine incubator. The meetup was finally scheduled for Saturday 27 May 2017.

Functional Programming, MSCC meetup 2017

Photo, courtesy of Ajmal Dookhan.

I reached Turbine at the Vivéa Business Park at 10h20 A few minutes later Yusuf and Renghen came. I was still waiting for somebody to open the door, as I was informed that there will be someone to do that. Unfortunately, we kept waiting, and as 11 o’clock neared attendees started to show up. Yusuf went to find somebody who could help. A guy came but he said he had no instructions about opening that door. I talked to JoKi but we both were in similar situation, like having same people’s contact numbers from Turbine, who were not reachable. Finally, I thought Vincent Pollet of could help us. JoKi called him up and indeed he got on his way to come open the door for us. Thank you Vincent, you saved the day!

FP 2017 meetup, Turbine incubator

Meetup started at 13h00 instead of 11h00. Sandeep stopped at Kendra Shopping Mall and bought us food. Although he was late he didn’t miss much.

Renghen talked about the history of Functional Programming, going as far back as LISP. He related how a Pentium bug when found in 1994, Intel hired a Haskell programmer to write a proof checker. He then triggered a discussion about “first class values” and Yusuf shared his thoughts about the same. The presentation was interactive with the attendees asking questions as Renghen proceeded through the slides.

Functional Programming - demo time

Renghen further explained about first class values, parametrized polymorphism, higher kinded types, persistent data structure etc. In fact, talking about the latter, he cleared a common confusion that “persistence” is not the same as saving to disk. He mentioned that mathematicians already had “types” before computer scientists; in the same line he would talk about Alonzo Church and his mathematical contribution like the lambda calculus. He talked about “meta programming” and locality of data. Then there was a discussion about “functions” and that the name itself has only been adopted by pop culture. In some programming languages those would be called sub-routines (e.g in Perl) or procedures. What is a pure function then? In simple terms it would mean a function whose return value always remain same for a given input. The return value does not change due to other factors during execution. Renghen gives some Scala examples:

def inc(i : Int) : Int = i + 1
def areaOfCircle(radius : Double) : Double = r * r * 3.14
def perimeterOfSquare(side : Double) : Double = 4 * side

Renghen’s slides and demo source code are available for download. If you’d like to catch up with him on the topic, do send him a tweet. I’m sure he will be glad to answer.

Three hours passed by. As it ticked four o’clock I started packing my stuffs. We requested Renghen that we continue the discussion in another meetup as the demo was only getting more interesting. Renghen agreed. Yusuf suggested that for the next meetup it would be interesting to solve a problem using PHP and writing the solution in Scala as well for comparison. Proof checkers in Scala could be written & demoed next time.

Keep an eye on the MSCC meetup page for the next meetup on Functional Programming.