The problem with python's map and filter...

… and how we might fix it. This is NOT a hate post. Let me say that again, This is NOT a hate post! Python is a fine language and it was my first programming language. Like the initial stages of falling in love with someone, you can’t see the flaws, the same was with python :) But as time goes by and the initial limerance fades, you start seeing the flaws....

November 27, 2021 · 10 min · Abhinav Omprakash

Recursion is recursion is recursion is...

Defining recursion in terms of itself is an old joke among programmers. Despite the fact that it frustrates a lot of new-comers, we don’t change it. I like to define recursion as “Iteration for the cool kids”. I don’t mean this in a snobbish, let-us-exclude-the-for-loopers kinda way, but rather in a tone of appreciation. Recursion is an elegant way of doing things. Recursive alogrithms are concise, have less noise and have immutability baked in (always a plus)....

October 27, 2021 · 9 min · Abhinav Omprakash

Clojure Tutorial for Beginners 1

Welcome, young lisper. I see you have heard the summons from the mystical forces. Prepare yourself for a journey like no other. Your view of programming shall change, and change for the better. You must shed your past beliefs and practices. This is a new path, one that bears little resemblance to the paths you have trodden before. And that is a good thing. Initiation rites You have two options - either use an online one-click setup or bite the bullet and install clojure and other tools on your local machine....

August 30, 2021 · 8 min · Abhinav Omprakash

Fold is gold: understanding reduce

Introduction reduce or foldleft is a very powerful function, but it can be quite tricky to understand and use. In fact, I used to think that reduce was an obscure function, that reduced (hehe) the readability of a program. If you ever want to make it as a functional programmer, understanding reduce is as important as important as knowing how to reverse linked list. I’m joking, knowing how to reverse a linked list is not that important, and it can be done with reduce!...

July 11, 2021 · 10 min · Abhinav Omprakash

Understanding partial functions

Welcome to the land of contrived examples and imperfect metaphors. Today we will be visiting a store called the five-item store. You’re only allowed to buy five items, no more, no less. The moment we enter the store, a cashier sees us and begins tailing us, and he keeps repeating “give me your items for so that I can make a bill” over and over again, so we just pick up an item and give it to him, and he shrieks and says “give me all five at the same time or none at all....

June 7, 2021 · 8 min · Abhinav Omprakash