Learning ES2015 : let, const and var

Lions at the zoo Zoos allow for safely viewing dangerous wild animals like lions. Lions are caged in their enclosures and can't escape its boundaries (if they did, it'd be chaos eh?). Handlers, however, can get into cages and interact with them. Like cages, you can think of variable scoping rules as establishing the boundaries and walls in … Continue reading Learning ES2015 : let, const and var

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 Sections 2.3 & 2.4: Thoughts and Ideas

1. Top-Down Design Most of the problems in the SICP book are solved in a top-down way with lower level details deferred until needed. The focus on high level details makes for expressive flexible code since implementation is based on well-defined interfaces and not implementations. Consequently, swapping and improving interfaces is a cinch - the dependency on high … Continue reading SICP Sections 2.3 & 2.4: Thoughts and Ideas