Recent Articles

Prolog Is Magic

Jul 16, 2019   #Prolog 
It’s hard these days to impress kids with stuff computers can do that felt like magic back in the early days. Turtle graphics, even the venerable Scratch don’t have the wow factor from the get go because .. the kids have seen too much already. Here is how I (re)discovered something magical in a moment of resistant engagement with my 6-yr old when he persistently asked me to “teach him how to work on a computer”. Read More ...

Good Ideas in Programming

Mar 20, 2019   #FP 

Collecting a bag of what I think are good ideas in the history of programming, which lead to better thinking about system design, implementation and evolution.

Note: This post will continously be edited to include ideas as they come to my mind as worthy of being included here. Also, the ideas are in no particular order and this is just a brain dump.

Read More ...

Automatic Differentiation: Higher ranked beings

Mar 13, 2019   #FP  #Haskell 
(Status: Draft) We saw how we can try to calculate derivates of a function while evaluating the function in the first and second posts on automatic differentiation. Those dealt with only functions of a single real number. While that is illustrative of the approach, it was merely warm up so we can deal with differentiable functions of multiple variables that yield multiple values - i.e. vector valued functions of vectors … or more generally, tensor valued functions of tensors. Read More ...

Automatic Differentiation: Dual numbers & Taylor numbers

Mar 12, 2019   #FP  #Haskell 
In the earlier post, we saw how we can calculate the derivative of a function as a function itself. We may not need to do that, but may want the value of a function’s derivative to be calculated while the function expression is being evaluated. Given a normal function expression (in Haskell, for the moment), it is possible to reuse the function definition to calculate its derivative using the idea of dual numbers. Read More ...

Automatic differentiation

Mar 8, 2019   #FP  #Haskell 

At Pramati Chennai, we’ve been having a series of sessions on math. The purpose is to try and connect many concepts usually considered as separate. We’re currently on a track to understand functions of multiple variables and their calculus.

Along the way, I thought it might be a good idea to try and introduce automatic differentiation in a programmatic way so people have a taste of how to precisely capture their ideas. This is not an attempt to implement the AD algorithms (at least not just yet), but to make the key idea concrete.

Read More ...

A hypothetical conversation with an 'imperative programmer'

Mar 7, 2019   #FP 

(This was originally written on May 25, 2015. Publishing it ‘cos a former colleague actually recalled it after all this time when even I had forgotten about it.)

Read More ...

Talk: Machine Learning as extreme TDD

Mar 7, 2019   #haskell  #gender 
I gave a talk last evening at a meetup at Navis giving a soft introduction to machine learning for an audience of mostly developers and QA engineers. I’m sharing the slide deck and also some corrections of mistakes I did in the talk. Click ml-as-tdd.pdf to download the PDF of the slide deck. The PDF has all the animation build stages as separate slides, so you can step through. I also showed some code towards the end of the talk which I’ll add here. Read More ...

async/await subtleties

Jan 3, 2019   #async/await  #Promise  #Exceptions  #try/catch/finally 
ECMAScript’s new async functions and generators simplify working with concurrent I/O code. While they work hand-in-hand with Promises, there are some subtleties that either seem to be underspecified in the language or not talked about much. For the purpose of this post, I assume you’re already familiar with the async keyword and its usage in Javascript as well as the await keyword for awaiting the result of an async function. Also, beware that though here you may find ways to use them that you didn’t know about earlier, but that doesn’t mean you should use them. Read More ...

Integers

Dec 14, 2018   #Integers  #Brahmagupta  #Number line  #Modulo arithmetic 
My son is learning about integers at school. It is quite a challenging topic to come to, especially as, thus far, for him, trying to understand it purely based on the familiar is both a necessity and a tough challenge due to the novelty of the idea. First off, it is not a big deal if kids are unable to grasp integers initially. They eventually do, but given that integers weren’t “natural” enough to be invented for millennia1, it is perfectly normal to not understand them from the get go. Read More ...

Hodja on Debugging

Sep 10, 2018   #Naseeruddin Hodja  #Debugging 
I loved Naseeruddin Hodja stories when I was a kid. Heck I love them now too. They give me a good laugh and, as is common with good humour, manage to point at some truth once in a while. One of these is a story where Hodja is searching for something in the garden. His wife asks him what he’s searching for and he replies he’s searching for his ring. She then asks him about where he’d lost it. Read More ...