Understanding and using Streams in JavaScript


Let's take a scenario from Mathematics, how would you model the infinite set of natural numbers? A list? An Array? Or a Stream? Even with infinite storage and time, lists and arrays do not work well enough for this scenario. Why? Assuming the largest possible integer an array can hold is x, then you've obviously missed out onx + 1. Lists, although not constrained by initialization, need to have every value defined before insertion.

SICP Section 3.3 – 3.5 : Found a bug in memq


1. Is memq broken? memq is an in-built list search function; it finds the first occurrence of a key in a list and returns a new list starting from that key. Now that you know what memq does, lets look at some weird behaviour Building on that foundation leads to the following conundrum memq tests whether the key exists in the … Continue reading SICP Section 3.3 – 3.5 : Found a bug in memq

SICP Section 1.3 : Thoughts and Concepts


This section exposed me to the full power and beauty of functional programming. The expressiveness of using functions as values is awesome. For example, a sum of cubes function can use a sum function which itself relies on a reduce function. Think of higher order differentiation in mathematics and you do get the idea. An interesting concept involves … Continue reading SICP Section 1.3 : Thoughts and Concepts

Understanding Partial Application and Currying


In pure functional languages, functions are not 'invoked', rather a set of arguments is 'applied' to them. Now, if all the arguments are not passed in, then the function is being  'partially' applied. Partial application converts variadic functions (i.e. functions with multiple parameters) into functions of lesser arity by pre-specifying certain argument values.

Understanding Tail Recursion


The biggest advantage of using tail calls is that they allow you to do extensive operations without exceeding the call stack. This makes it possible to do a lot of work in constant space without running into out of memory exceptions; this happens because the frame for the currently executing function is re-used by the newly-executed function call.

Programming Language Type Systems II


Strong/weak typing describes the ease of mixing variables of different types in expressions. Strong typing does not imply static typing just as weak typing does not mean dynamic typing. To put it simply, if a programming language tries to interpret an expression containing variables of varying types at runtime (e.g. adding an int to a … Continue reading Programming Language Type Systems II

Thesis Stories Ep 3: Research is Hard!


Alhamdulilah I completed my thesis about three weeks ago; if you're interested, you can check out my thesis and presentation. Looking back at the two years I spent at MASDAR, I have a couple of thoughts: Alhamdulilah I learnt a lot, met a couple of wonderful people and matured significantly. There were a couple of not-so-pleasant experiences too but I believe … Continue reading Thesis Stories Ep 3: Research is Hard!

MOOC Talk : And I thought I knew SQL


Massive Open Online Courses (MOOC) became popular early this year with offerings from Coursera, Udacity and EdX. These platforms were inspired by the phenomenal success of the three online courses (db-class, ai-class and ml-class) that ran in late 2011. It has never been so easy to get high-quality knowledge - for example, Coursera has renowned … Continue reading MOOC Talk : And I thought I knew SQL

Thesis Stories : Wrangling with HUGE data


My thesis takes all my time: I have to review papers, write out my thoughts, build a platform, attend classes as well as poke into Big Data; and my blog has been at the receiving end. This story about big data came to my mind while I was thinking about my planned work on the stackoverflow (SO) … Continue reading Thesis Stories : Wrangling with HUGE data

JavaScript: The functional Programming Parts


Yes, a lot of people think JavaScript is just another object-oriented language but the language differs in many ways from the Java/C++ class of programming languages. For example, JavaScript uses prototypical inheritance versus the classical inheritance favoured by OO languages; this makes it easier to get on new behaviours... and also makes it really really easy to shoot yourself in the foot.