# Check Endianness with JavaScript

How to check for endianness using JavaScript

# Guaranteeing software behaviour

My foremost goal while building software is to build stable self-healing systems with deterministic behaviour. I want to ensure my code continues to work even when unexpected events occur. In the event of unknown unknowns, the expectation is a graceful degradation in the worst case.

# The Exclusive OR (XOR) Explained

I recently ran into a code puzzle; the question asked for the finding the unique element in a list of integers given that every integer appears twice except the single special element.

# Why you should not use isNaN in JavaScript

Nan literally means Not a Number. Yes, it means that value is not a number and occurs when you try to coerce a non-mathematical value (e.g. string) into a number.

# Why computer science matters for software developers

I used to think computer science never mattered because I rarely used algorithms and never saw the value of algorithm-based interviews (I still don't ;) ). The few folks I asked also concurred so I felt I was right.

# What every programmer should know about types I

the mathematical concept of sets in number theory. The set of integers can be seen as a type - only values such as 1, 2, 3 are integers; decimals (e.g. 1.1) or irrational numbers (e.g. π) aren't members of the integer set.

# Why JavaScript has two zeros: -0 and +0

Do you know there are two valid zero representations in JavaScript?

# A simple explanation of 1s complement arithmetic

A simple explanation of 1s complement arithmetic - a basis for how computers run.

Bit masks enable the simultaneous storage and retrieval of multiple values using one variable. This is done by using flags with special properties (numbers that are the powers of 2). It becomes trivial to symbolize membership by checking if the bit at a position is 1 or 0.

# 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.

# Why JavaScript ‘seems’ to get addition wrong

This post was actually motivated by Gary Bernhardt's very popular WAT talk. It aims to provide a deeper understanding of how JavaScript evaluates expressions and operations on primitives and object types.

# How to implement the Y-combinator in JavaScript

This post provides a very simple step-by-step implementation of the Y-combinator in JavaScript. You should be able to implement the Y-combinator in your language of choice after reading this post; as you'll see - it's that easy.

# 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

# 5 things I have gained from SICP: Section 1.2

What I learnt from Chapter 1.2 of the SICP book. A needed pause to reflect on knowledge gained before diving into 1.3.

# 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

# Programming Language Type Systems I

Static, dynamic, strongly-typed and/or weakly-typed; the terms we routinely use to describe typing in programming languages. However, these terms (especially the last two) have more to them than is generally assumed.

# MOOC Review : Machine Learning

My review of the MOOC on Machine Learning

# 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