I attended a meetup organised by the Polyglot Languages and Runtimes meetup group on Functional Programming this weekend. I was very attracted to the topics but I was particularly interested in the session on R programming language. It was organized in EGL which is quite far from my home. It took me an hour to reach the place and that was only because I used side roads to skip the traffic. I reached at time but it took me 15 minutes to find the correct building for the meetup after being misdirected. Fortunately, the meetup had not started by the time we reached. In fact, it was about 5 minutes after I was settled that the first session began.

Functional Programming – Past, Present, and Future

We started the afternoon with a presentation on “Functional Programming – Past, Present, and Future” by Pushkar Kulkarni. We discussed the functional and imperative programming concepts and how they started. Imperative programming started with a pragmatic approach to programming with Assembly and other higher languages building on Assembly. In parallel, functional programming dealt with the mathematical side of programming. We discussed the history starting with Alonzo Church formulating Lambda Calculus, Alan Turing, LISP, etc… We then discussed some academic research on functional programming – ISWIM (1966), SASL (1972), MetaLanguage (OCaml), … (Haskell)

We then went on to discuss first order functions and higher order functions. Simply put, a higher order function either accepts a function as an argument or returns a function. We discussed Erlang and saw a simple program written in Erlang. We discussed map and filter constructs and touched upon immutability.

We also discussed Haskell which is a “full blown” programming language. Here the entire program is just an expression – there are no statements. We also briefly touched upon Algebraic Data Types, Pattern Matching, Currying, and discussed some examples. We then looked at an example of Currying in OCaml.

We then turned towards Java and saw which languages support functional programming on JVM. We discussed Scala and a simple example to count items in a list. This led us to discussing tail recursion. This was followed by Clojure, which is an implementation of LISP on JVM. We saw an example involving Fibonacci numbers and concept of pure functions. We then discussed the concept of Lazy Evaluation with an example on Java 8, which has added support for functional programming.

Finally, we looked at a couple languages like Idris and Agda which are upcoming. We closed the session with a discussion on why functional programming should be used.

An introduction to the OCaml language, and its functional aspects

This was a lightning talk about OCaml language given by Dinakar Guniguntala. We started with a history of OCaml, how it came about and how it has influenced languages like Rust, Swift, F#, etc. We discussed its typing discipline, which is static, strong, and inferred. In other words, it doesn’t juggle types and the “variable” types are inferred when they are declared. We saw a live demo of some snippets run on a website which allows you to run OCaml code.

The R Programming Language: An Informal Introduction

After a quick coffee break sponsored by IBM, we gathered again for a session on R by Dr. Ramana Polavarapu. We talked about the unusual name and its predecessor which had a similarly unusual name. We saw some of the syntax and quirks of the language compared to most other languages. We saw some of the features of the R programming language which are especially useful for statisticians. We then saw the data types built into R such as numeric, character, factor, data frames, and operations. With this we looked into how to write programs using R with simple conditional operations. After this, we started considering R as a functional programming language. R functions are first class citizens which means that functions can return functions (with properly scoped variables). Anonymous functions are also supported.

We also then saw syntax that allows working on arrays/lists very easily. All functions and operations work on an array in a natural manner. Even operations like map and filter are very simple and straight-forward, almost beautiful. We then saw immutability (it is not immutable) and recursion in R.

Going Swiftly Functional

The last session of the day was on writing functional code in Swift by Pushkar Kulkarni. This was a lightning talk just covering the syntax for closures, map, filter, reduce, and other similar features on Swift. We saw these as a live demo on IBM Swift Sandbox which allows you to run Swift code in browser. It is available for free and also allows you to save your code online (needs registration).

Going Functional

We had a trivia quiz and few questions between sessions and gifts were given out. I got a couple of chocolates and a pen-drive. I appreciate the efforts of organisers and speakers for a great meetup and informative sessions.

My winnings stash so far at #meetup on #functional #programming

A photo posted by hw (@hussain.web) on

Here are some more photos from the event.

Going Functional Meetup

Tagged with: