Devlog Week 4: Clojure Game Built

This week I completed building the Chain Reaction game I started building the previous week. I previously built it in Javascript (Play) , and it was super fun building it in Clojure (Code).

There are some key differences to the approach I had for the game in Clojure and in JS. Although, after building the game in Clojure, I knew I could have built it similarly in Javascript, but the approach was intuitive in Clojure.

  1. Separation of Concerns

In JS, I used the Fabric canvas library to build the game, and all the UI code along with board state was all in one big hotchpotch. (/me cringes). I separated the layers clean in Clojure, the core game logic is a clean interface, and there is one method to get the updated state of the board given the old board, player, and move, and one to check if there is a winner.

  1. No huge N*N array to store EVERYTHING.

In JS, I had a n*n matrix for board size n, and had all the cell and orb UI objects along with their state (/me cringes) dumped into it. When I built it in Clojure, I had a map with the following structure that only had the cells that had any orbs in it.

{ row {col {:owner owner, :curr_orbs curr_orbs :max_orbs max_orbs} } }
  1. No nuking state.

The entire game in JS worked by modifying the global data structure for the board and the variables for the current player. With all that absent in clojure, getting a new board and player happens functionally, which is super clean.

  1. No Fancy UI.

This is just me deciding it is pointless to build a game in Swing, and building a pretty printed version on the console instead.

Many such differences, but key idea: just by picking up Clojure as a tool to build the game, the same stupid programmer me who wrote cluttered code in JS 2 months back, can write clean code, which is what I find amazing about the language and the functional approach. I've also fallen in love with the map, reduce, and filter functions, and wondering how I lived without those till now.

Apart from the game, I made some more progress on the Intro to Statistics class I was taking. This week should see more mileage on that.

Proud and Crazy

Let's start with Crazy.

This week had the most terrible weather I've ever experienced. A combination of snow and negative temperatures, ranging from 0 to -11 ºC. Like it'd stop anything though.

On thursday, I went to the alumni games night at Fat Cat. I don't drink, so never thought I'd enjoy myself at the bar, but this one was real awesome. I spent over three hours, meeting people, playing ping pong and card games and a bit of foosball - and it was way too much fun. It was -10ºC when I walked back home that night.

First bar stamp :D First bar stamp :D

Ramp up the crazy. On friday evening after spending time writing solutions to recursive problems at Hacker School, friends there suggested we go out. I say yes. And then we come up with the idea to walk the Brooklyn Bridge. It's really not a long walk, it takes 20 odd minutes. But well, it was -6º Celsius. On the end of the bridge, none of us could feel our feet or hands, and all we wanted was a warm and cozy inside. After a lot of food and hot chocolate and feeling completely exhausted, I go sleep.

Brooklyn Bridge Brooklyn Bridge

-6ºC -6ºC

Come Saturday, and feeling brave enough to do anything, I decide to go to the indoor rock climbing gym, Brooklyn Boulders. After my experience ice skating I knew if I wanted to do something I better learn it right, so I took a short class at the gym on rope climbing. Staying on the ground and learning to work the knots and the harness and the belay was all very fun. Okay now climb. I gulp. I also climb. That wasn't so bad. I'm on top of the wall. Ok how do I come down? Just let go of both hands and feet, and put both feet flat on the wall. Er what? Let go? Yes. No. Yes. Okay. Ummm. 2 minutes later I knew if I din't let go I couldn't come down at all, and there was no point hanging up there like a frog. So I did let go. And that, was liberating. The next few attempts were a lot better.

After that bit of insanity, I went out with a friend for some sane shopping on Canal street, and had lovely Thai food.


And then Sunday. I kept to calm and quiet most of the day, and went to dinner with few Hacker Schoolers to an Indian restaurant at Queens. It was extremely interesting to explain Kadai Paneer, Dal Makhani, Raita and Naan in English, and make them all eat with their hands :D


But what makes me really proud this week is that I cooked lunches for myself throughout the week :D Who could have known I could pull that off!

Devlog: Week 3: More Clojure, and a bit of Stats

Over the last two weeks I've continued to learn Clojure. Bunch of things I've done.

  1. Trying to read the book, Joy of Clojure, which gives wonderful insight into why and how the decisions that shape Clojure were made. This is definitely not a beginner book, but I found it more comfortable to read as it talked about the bigger picture instead of going through syntax chapter by chapter. However I kept encountering pieces of code that were written in all but 4 lines, and I had to ponder for 30 minutes as to what the construct actually did and then figure out it was Clojure's arity overloading mechanism.

  2. Solved the Clojure Koans. There are Koans projects that exist for most of the prominent languages, and starting from a beginner level it ramps up how much you learn through those exercises without assuming any prior knowledge. Over a day and a half I solved the entire set, and felt much more ease in reading and writing syntax when I'd done that. My solutions are at

  3. Started building a game in Clojure. I built a version of the Chain Reaction Android game in Javascript a while back. It's at - I decided to port it to Clojure to try and understand how to build it without mutating arrays and variables which is pretty much how the game works in JS. I've just started work on this game and hope to finish it the coming week.

  4. Taking the Intro to Statistics class. One of my interests has been to learn data science, and to get started, I'm taking the Udacity Stats class by Sebastian Thrun. It's been pretty interesting so far, but I'm just scratching the surface.

  5. Played with recursion at Jobs Friday. On fridays afternoons, to iron out job interview related concerns, we have working groups of people sitting together and solving problems on a theme every week. This week was recursion, and I solved a few problems using Clojure.

Aside all this, we were introduced to the Elm and Julia programming languages this week. Unlike people doing tutorials on languages like everywhere, HackerSchool made this phenomenal by getting Evan Czaplicki and Stefan Karpinski, the designers and developers of these languages talk about it themselves! They were also residents this week at Hacker School.

I've been pretty happy with the volume I'm learning, but need to write more code! That's for the coming weeks.

The must do's at Manhattan

I've ticked a few things on the universal NYC bucket list off this weekend.

I went to meet my college friends from undergrad, who now study in Brooklyn, on Saturday evening, and they suggested we take the Staten Island Ferry up and down, the hack to seeing Statue of Liberty free of cost. It was a beautiful ride, watching the city filled with lights, and the towering Liberty Statue, like a scene out of the movies, but a feast when you see it for real.

DSC01332 DSC01331

Oh and Times Square. Of bill boards and neon and lights. Of fashion and chocolates. And of Batman and Spiderman and every comic book character in costume. I went with a friend from Hacker School, who also considers pointless window shopping as therapy. And so it was.

IMG_2696 IMG_2702

I've also started saying 10ºC is warm. This weekend was really warm. And fun. Until snow comes back on Wednesday.

More learning

Continuing on learning and picking up whatever comes my way, I'm gonna add two more feathers on my cap. Okay some semblance of feathers.

After years of failed attempts, I finally learnt the one thing that every kid knows but always eluded me - riding a cycle. I'm no expert even now, but I learnt to stay on a bike without falling off in an indoor gym in a beautiful island called Roosevelt island. If not for the rain that day, I would have sat by the East river and lost myself in thought for the whole day.

And, I'm cooking for myself. Well, a little bit. And I said it, only myself. My inspiration to cook springs from my new found dislike for Japanese food. I ate it for 2 days successfully, both days ordering sandwich at different places, paying 13$ each time, and getting bowls of tasteless brown rice, asparagus, eggplant, seaweed and so on.

Since then I've braved a trip to Roosevelt Av on Queens to buy our very own Indian spices and dahi and what not, and felt like I'd gone to India and back. And I've been making little things. A dal, something that resembles a pulav, some beans, and it's all been edible. And better than Japanese food. Low standards and too small a test set you say? True that. But who wants to be the scapegoat to my cooking :D

Week 2 at Hacker School: Learning

The last week at Hacker School was filled with talks and workshops. I'm gonna try and recap the stuff I learnt over last week.

It started with Mel's talk on Edupsych theory for hackers. Mel is one of our residents, and coming from a world of academia and being a hacker, she has rich insights and conclusions on how hackers learn. Talking about the importance of being productively lost, test driven learning, pair programming, identifying your learning styles, and how motivation and mindset is key, she gave direction at a point when I was wondering how best I could learn when I was at Hacker School. The talk was hosted at the Ebay office in New York.

Mel followed up on the talk by running a workshop the next day on identifying learning styles. People learn differently, Some active some passive, some sequentially some globally, etc. Over the workshop we all learnt what style suited us. This tremendously helped because I discovered I was a global learner who was clearly killing time trying to read a sequential textbook.

Our other resident for the week Greg Price, who is this amazing kernel hacker, ran a bunch of workshops that were immensely useful.

The first was on "What is this process doing?" - about how to examine processes that we din't code, and debug them. He talked about two approaches, outside, from the OS, and from the inside. The first approached covered using tools like /proc/$PID, lsof, tshark and strace. And the other included profiling using perf or debugging using gdb or specifically for python, pdb. It was a whole new topic I'd never explored, and hoping to poke into this stuff more soon.

He also did a source diving workshop, about how to effectively delve into huge repos of code we din't write and wish to contribute to. This is something I definitely learnt a lot from, and when I actually source dive using the tools he explained, I'll write about it in more detail.

Alan, one of our facilitators, along with Greg, also ran a Git internals workshop, and talked about having a good mental model of how Git works, which helpssa lot in place of remembering a whole lot of commands blindly, and being completely lost in the face of "non-fast-forward updated" errors. I was pretty pleased I knew some of this stuff already, thanks to a talk Vagmi gave at Chennai Geeks a long long while ago.

There was also the Goal setting workshop our alumni Stacey ran to help people who hadn't defined their goals for Hacker school do that. And a bunch of other smaller workshops, talks on jobs after hacker school, etc.

Phew, that was a lot of workshops and talks. All incredibly useful. And making Hacker School totally worth it.

Art and Ice

I grew up fearing and not attempting any outdoor activities whatsoever. Swimming, biking, driving, skating - you name it, I don't know it. When I read the introduction emails of other people coming to Hackerschool - their sense of having one more thing in life outside of code that they were as good at really struck me, and made me want to be that person too. So I decided I'd try everything that came my way when I got here.

So when my roommates here planned to go Ice skating on the Winter Garden Ice Arena I jumped in too. So I went today, fell 4 times, and made a fool of myself. It made me wonder if I should just stick to my computer, but meh, it was worth trying :)

I also got to see the World Financial Center buildings at Wall Street, the constructions at the WTC site and the new NYC Winter Garden arena.

Winter Garden NYC Winter Garden NYC

My Saturday was a little less adventurous, and I went to the MoMA with fellow Hackerschoolers. I can't really criticize or appreciate art, but it was a lot of fun visiting the Museum of Modern Arts. I saw amazing painting, sculpture, architecture and photography exhibits from Picasso to Andy Warhol, and could only cover 3 of 6 floors.



The perfect ending to my weekend was dinner at Saravana Bhavan at Murray Hills. South Indian food <3

Devlog: First attempts at Clojure

I've been wanting to learn functional programming for quite sometime. I've had two failed attempts at SICP and the Scala course on coursera, so in my first week at Hackerschool, I'll decided to take a swing at Clojure.

For the first day I worked through reading the Clojure Programming book, and solving problems at, but I grew really restless doing that. I thought doing a tiny project may get me into the groove better, so decided a small IRC bot. After some discussion on the Hackerschool internal IRC like chat, Zulip, I decided to build a bot with the Zulip API, with @ptn.

The goal was to build a command line tool that anyone could configure with their own Zulip bot API keys, and it would help them read on terminal only content from streams they subscribed the bot to, helping to read only specific content, freeing from the noise on Zulip when you wanna work distraction free but still wanna catch important announcements. The full code is here.

Interesting thing I learnt was how easy it is to read and parse data structures from other clojure files. This is all that is needed to read a file and convert it into it's original data structure, a map in our case.

(read-string (slurp "config.clj"))

For HTTP requests to the Zulip API we made use of the clj-http library. And for parsing the string JSON responses and converting them to Clojure maps, the data.json library.

Post that I've started doing the SICP lectures once again. One lecture, related book reading, and exercises done. Although I'm trying to do those in Clojure. Code for the SICP stuff is here.

I've also moved from bash to zsh, only because it seemed like a cool thing to try.

Now to do more the coming week.

Week 1 at Hacker School

It's been one amazing week here.

Day 0: The women dinner

The women facilitators of Hacker School put together a low key dinner for all the girls of the batch on the day before the batch started. For the first time, I was walking in the snow while it was snowing to get to the dinner at Brooklyn. There are 14 girls of 50, a little lower than the previous batches. But having come from a world where I'm usually the only girl in the room at hackathons I helped run at Chennai Geeks, 14 girls is a huge number. And I was elated to meet all of them, and was thoroughly taken in by the diversity - computer science grads who rock climbed, geophysicists learning web dev, to name a few. After hours of immersive discussions, out of which mock prototypes of very interesting devices came up, I was headed home, totally excited for the next day.

Day 1: The beginning

I walked into the HackerSchool space at SoHo, and, I was stunned. A cute welcome breakfast spread with muffins and croissants and caffeine on one side, an Apple II computer and a library that you'd want to devour on the other. And over 50 amazing people, all set out to become the best programmers they could be in the next three months.

As the room abuzz with introductions and networking calmed down, the founders and facilitators did a lovely job of welcoming us. Explaining to us the social rules, asking us what are anticipations and aspirations were for our time there, and giving sound guidance on how to handle them. The number of people and the experience they came with overwhelmed everyone, making us wonder if we really deserved to be here, but they convinced us that we did indeed.

Swearing to make the best of my luck to be there, I went and made my plan for the day. I've wanted to start with functional programming, and failed my first two attempts at doing that. So I decided I'd learn a bit of Clojure to get started. I spent a few hours learning syntax and solving problems on

After dinner from Chipotle - on Monday's everyone stays and has dinner together at the space, I was off, sinking in all the awesome new experiences of the day.

Day 2: Checkins

The only one piece of rule instruction at HackerSchool is Checkins. At 10.30, you meet up with a group of people you are assigned to, and talk about your progress for the previous day and goals for the day. It helps to be socially accountable and keeps you motivated, and the groups change every 2 weeks.

I checked in with my group and told them I was planning to a small project with Clojure, because working through books got boring for me after a while. I paired with a friend who was interested too, Pablo, and started working on a bot for Zulip, the IRC like chat system used internally at HackerSchool.

Day 3: Project 1 done

The zulip bot I built in Clojure helps you read on the command line filtered out messages from streams one is subscribed to. There is way too much traffic on Zulip and this might help in not getting lost reading those but focussing on only things you want to read. And it worked.

Day 4: First presentation and board game

I spent the whole of thursday working through the first lecture of the famed SICP MIT course, and attempted solving the associated problems in clojure. Every thursday there are optional presentations on what people have been working on, and with my teammate, I demoed my bot. Of course Murphy came in and stepped on the API rate limit and it din't work during the presentation. But I had something to show, and that felt good. Although @davidad demoed how he built - - on the Apple II, and stole the show. /\

In the evening, some of the Alumni from previous batches came in, to organize Game night - of pizzas and board games and consoles. I was dragged away from incessant chatter with alumni to play a game called Love Letter, a card game involving deduction and luck, and as luck would have it, I won the first game.

If one thought of staying there longer, one was disturbed by the snow storm they had endeavored earlier in the day and the rain outside, and one left.

And thus ended my first and most terrific week at HackerSchool. Devlog on my project coming up next.

Chennai to NYC

I got to New York city on the 3rd of Feb, so this blog post is slightly delayed. But it's been one hell of two weeks.

An application and two interviews later, I got accepted to Hackerschool for their Winter batch of 2014, in the end of December. Everything then on, has been interesting. For example, my visa interview. When is the last time you heard somebody had two interviews at the US consulate? At the end of two hours of waiting, two sets of being asked the same questions, doubts as to whether such a thing as Hacker School existed, and whether I was going to learn to break into people's computers, and contemplations on backup plans of backup plans of what I'd do if my visa was rejected - the embassy sided with my dreams and approved my visa.

The idea of leaving Chennai, my job, and all the people close to me, was hard. One fine day though, the 2nd of Feb I had to pack up my bags, press pause on all familiarity, and fly to a new place, and make a new life - new people, place, and, of course, the weather. The weather. I landed at NYC on a Monday morning, but for a fleeting few seconds, I wondered if I was at, ummm,

Greenland. I stepped right out into the snow from the Airport. But that, was a lucky day.

The girl next to me on the flight worked for Google in India, and was visiting their office in Chelsea. Helping me throughout the exit from the airport, she went one step further and shared the taxi ride - that costs 60$ for each person otherwise - with me to Midtown Manhattan.

I got off outside the door to apartment, and stood there. My flight had been delayed by a few hours thanks to snow clearance delays on the runway, and my host, would be at work. As I wondered what I'd do, someone who lived in the building buzzed me in. Now I stood inside, no wifi, no local phone number, wondering how to contact my host. New girl in a big city, lost.

I then hatched a plan. I'd keep my suitcases outside the house on the fifth floor, get out, go to a cafe, and reach her. So I lugged 2 suitcases up five floors. I am terrible with luggage, and I'm terrible with stairs. Finally, when I had one piece of luggage left to carry one flight of stairs, I was delving in a huge sense of personal achievement. And I turn, and my host walks up the stairs, she was home for lunch. I've never felt as lucky!

I spent my first week in New York buying thermals and jackets, finding my way on the subway, braving the cold. My amazing roommates and the amazing neighborhood in Manhattan, make my days so pleasant. The first 5 days flew by. And then there was Hacker School.

More on that next.