Wednesday, December 28, 2011

First steps in Learning LISP

My Road to Lisp started with an accident. I was looking for reading up on something about Hacker culture. One thing lead to another and before long I was installing a Common Lisp flavor in my machine.

But I am jumping myself here. The story starts when I was looking to read something related to Computer Science fundamentals. Why something? Well, just for the heck of it. To rub an itch, so as to say. I wanted to make a detour from my regular day job and indulge in something which is closer to my passion of technology. So, I started reading up on UNIX and Internet history.

This wonderful book Where the Wizards stay up late transported me to the era when DARPA was funding inter-networking R&D project. The main story had a side plot on what happened in AI Labs at MIT in early 1970s, how Richard Stallman's life took a turn which has had lasting impact on the politics of software and how UNIX gained traction in academics community while other existing systems slowly went into oblivion.

After a while I picked up Tenanbaum's book on MINIX. I was revisiting concepts of process scheduling, memory management, thread management etc while also getting introduced to the debate of monlithic vs micro/modular approach to kernel design. This led me to discover Tenanbaum vs Torvalds debate, discovery about GNU Hurd and again encountering RMS.

Any mention of RMS goes without bringing up concept of Free Software movement and later forking of Open Source movement. This story has its stalwarts, apart from RMS and Torvalds, like Eric S Raymond (ESR) and Paul Graham. I read up on different licenses supporting FSF and OSS, differences between them, the business model of FSF and OSS, how OSS is being marketed and how the latest developments are playing out in field of handheld devices. ESR brought me the joys of Hackers and Painters, The Cathedral & The Bazar and various pieces on hacker culture. Paul Graham had great insights to share through his experiences at Y! Combinator.

Through all this, I kept hearing about Lisp:

  • RMS worked at MIT AI Labs and Lisp was being heavily used there
  • Discovery that there were Lisp Machines built specially for programming in Lisp and that there architecture was different from von Neumann architecture based on which Personal Computer revolution (the story arc of: Altair, Ed Roberts, Bill Gates, Steves - Jobs & Woznaik, IBM, BASIC, DOS, Xerox PARC, Doug Engelbart, Windows, MSFT, Apple, Pirates of the Silicon Valley, Fire in the Valley)
  • RMS's life turned upside down by the blow dealt to hacker culture of MIT by politics of Symbolics and LMI (both companies making Lisp Machines)
  • AI Lab becoming dysfunctional; RMS seeking out to make a free OS to have a development environment which provided full freedom to its user
  • RMS starting to port Emacs from AT&T's licensed UNIX version to a free version
  • Development of Emacs Lisp (a flavor of Lisp) to make Emacs extensible 
  • (Seems after this RMS's energy got directed towards making a kernel for von Neumann architecture machines and thus the emphasis to generate a free development tool chain - compilers, debuggers, editors, etc. - for a UNIX like free kernel; as a result C gained prominence in FSF output)
  • In came AI Winter; funds dried up for AI research and Lisp, already taking a beating from C on the front of OS and app development for PCs, started to lose prominence
  • Paul Graham sets up ViaWeb and a web service (later to be rechristened Yahoo Web Store); which have code written mostly in Lisp, give super performance and have unheard of RAD capabilities
  • Paul Graham becomes a proponent of Lisp and sets out to invent his own flavor (Arc)
  • ESR promotes Lisp; says that even if one is not going to ever use Lisp for production level code, Lisp should still be learnt because its style & power expand your programming thinking for better
  • Discover in TIOBE that Lisp is still in top 10 languages in prevalence
  • Discover Greenspun's Tenth Rule -- which says that all computer languages are ad hoc and bug ridden implementation of a subset of Lisp features
  • Read Golder Escher Bach by Douglas Hofstader - discusses Lisp
  • Read and worked through the Little Schemer - discovered the world of atoms and S-exp
  • Went ahead and installed Emacs for Windows (didn't have an opportunity to setup Linux on personal machine while dealing with my day job), clisp & slime. The tool-chain is now ready.
  • Started reading and working through several Lisp books simultaneously - ended up with seriously following SICP (one of the best CS course books ever written) and Practical Common Lisp
  • Joined Quora and StackOverflow forums on Lisp
  • Got also introduced to Haskell. Started reading Learn You a Haskell for Great Good. Its a pretty impressive book. 
  • Installed Haskell compiler. Soon was writing code in Haskell lexical structure and with tail recursion.
  • Computer crashed. @#$#@!$!@$^%!$@%

Wednesday, November 30, 2011

Hippo-The-Potamus

Just discovered that Hippos are the most dangerous animal in African continent. Much more dangerous than carnivores. They just beat the crap out of all knowing / unknowing adversaries including crocodiles, rhinos and lions.

Here is an African folk tale about "The Making of Hippo". :)


According to the tale, hippos were one of last animals created and were thrown together from an assortment of leftover parts.  The hippo was embarrassed by its ungainly appearance and its hairless, bulky body.   It asked the Creator if it could remain concealed in the water by day and come out only under the cover of night in order to feed.

The Creator refused, saying that the hippo would use its huge mouth and vicious teeth to eat all the fish.  The hippo responded by promising that it would eat no fish, but only the nearby grass.  The Creator was skeptical, but offered a compromise: the hippo could spend its days in the water, but it must come out to spread its dung on the land where it could be inspected by the hovering kingfisher to see if it contained any fish bones.

The hippo agreed and to this day it leaves the water to spread its dung on land where it can be inspected by anyone who cares to do so.  (Some less imaginative types suggest that the hippo spreads its dung to mark its territory.)

Thursday, July 21, 2011

Books are back


Installed Mobipocket Reader on my Blackberry.
1. Since I don't own another smart phone, Blackberry double times as official communication device and all uses of mobile internet (primary use: Google maps navigation, stock updates, wikipedia searches, fB, Gmail). I have been looking to buy a tablet, with the primary purpose of serving as an eReader.
2. Reading books smoothly during office transit was being hampered by Mumbai local transport's errrr...gonomics and rains.
Mobipocket Reader works magic. You can install its reader on Blackberry, install pdf/html/doc converter to Mobi format on PC/Laptop, transfer books to Blackberry using PC software. On mobile, it has enough settings options (font, background color, line spacing, margins, bookmarks, annotations) to give a comfortable reading experience. Blackberry's form factor is very very convenient for handling in local transport (slip in and out of top pocket while an umbrella usually dangles in one hand; and making way through crowds by effectively using 'shoulder shove'). An obvious option is to buy Kindle, though I dont know how convenient will be its handling in Mumbai transit conditions. For now, I love this totally zero cost solution.


Wednesday, June 29, 2011

Of bathroom

Bathrooms (and I will stick to this nomenclature than the technically correct "toilets" which I am referring in this post) are places of great sublimity. You connect with yourself on delicately various levels in a bathroom. From physical to mental to downright spiritual. A closeted, private space all for yourself when the world around you may be maddening in cacophony and reaching out with tentacles to drag you in its depths. A refuge of silence, a bubble of hope, a whiff of freshener fragrance reminding that even the worst can be masked if you apply right techniques.

We have such a single occupancy relic in our office. It caters to 13-16 people daily. It will be a nice probability problem to work out chances of two colleagues wanting to use it at the same time. Results get more interesting if you mix in time-of-the-day as a variable, viz. office arrival, office departure, post-lunch, evening siesta etc.

HR policies keep trying to imbibe a sense of togetherness in a bunch of people who normally prefer to remain cocooned in their own cubicles. They must learn a lesson or two from the strategic importance of bathroom. Its single occupancy has helped our office colleagues to be more aware of each other. Every colleague keeps a watch on who is where and how should he/she tactically time his/her natural urges to get unobstructed access to this precious resource.

Minds start keeping log of each other's bathroom habits. We have in our minds undeclared bathroom ninjas, Zen masters and kamikazes.Ninjas get in swiftly, get done with their work in minimum noise (and smell) and come out without leaving a trace. Zen masters like to contemplate on life issues and universal truths sitting on the pot, sometimes going through elaborate rituals of flush-sound-making. Maybe they would see life's twists and turns in that whirlpool which sucks all life's muck deep within the pot's bowels. Kamikazes are a dreaded lot. Collateral Damage is Western word for aftermath for their actions. They destroy the very peace fabric of the bathroom. They leave behind a trail which is hallmark of their operations and impossible to miss. After their mission, they leave the destroyed place with war marks (water splashes only, hopefully) on their trousers and wet light switches smeared by un-dried fingers.

This particular bathroom has a special place in my life journey as well. It bears witness to last 3 years of my work-life as well as personal life. It has been a friend in need. Whenever I have wanted to run-away to Wonderland, it has served as my rabbit hole. I have even explored its innards by opening up ventilation shafts and peering down gaping holes 30-storey deep imagining how it must have felt for our leather-clad world saviors in The Matrix. I have talked to its faucet, tested kung-fu moves on its walls, danced a jig-or-two, drafted pensive SMSes and even tried standing meditation in a corner.

It struck me how much my relationship with the bathroom (or rather reason for using it) showcases what I am going through in my life. When I was going through a personal crisis, I have spent lot a time in this bathroom hiding my grief from the world, trying to calm down my nerves, feeling protected in a way. And just the other day, I went through the whole motion without even giving as much as a thought and I worked my way quickly towards the exit. As I stepped out, I just happened to notice this difference - between my sojourns to the bathroom in difficult times and now. I have flushed it all, figuratively and literally.

Wednesday, May 04, 2011

Sweet in a salty evening

After a particularly long day at work and meetings, I ended up frantically hailing cabs at a busy junction to get to my corner of peace. Those black and yellow (called kaali-peeli in local slang) metal bundles of joy kept evading me in frustrating ways. One pulled over right next to me, only to my exasperation to see it roll further few feet and stop next to a couple of homely looking aunties. Cab driver had exercised his discretion and left me with salty secretion on temples.

Then a seemingly mild-mannered Chachaa (former 'a' is pronounced quickly, later 'a' is pronounced elongated) cab driver let his benevolence fall over me. Unlike the usual demographics of Taxi Chachaas, he was neither a Muslim nor was he hailing from North India (becomes pretty apparent from accent). On our short journey back to my home (low fare --> another reason why I was being refused by others), Chachaa just happened to get himself in the wrong lane on a busy U-turn. After much cussing and hand-shaking at the driver in front of him, he could manage his way out gingerly among the red monster BEST buses and other nimble cabs. Stil hot under the collar, next he managed to set himself on collision course with a 4-wheeler contraption, which I have not seen in such huge numbers anywhere outside Mumbai; a scooter with a side-car. The 4-wheeler driver had much to say about Chachaa's eye-sight and driving skills even within the fraction of second in which the two vehicles hugged each other.

Chachaa was mutteing under his breath. I had had a long day, so just wanted to get out of the roads and shut out honking noises from my mind. Then, I dont know why, I just felt like making Chachaa feel a little better. Two battered souls fighting against unforgiving world inside same metallic combat vehicle. Exaggeration aparts, I offered Chachaa a glass of lassi at the end of our ride. He refused politely several times. But, I insisted. Earnestly. He gave excuse that there isnt much of parking space and his vehicle will get towed away. I offered to serve him lassi within the cab, he just had to stay inside.

Reluctantly he agreed. While I was fethcing him the drink, another passenger had already hailed him for next fare. The passenger was amused to see a guy dressed in business formals with a laptop bag on his shoulder bringing two glasses of lassi, placing them on the bonnet and sharing a drink with cab driver. He had started getting angry about why the driver was not turning on car's ignition. But this scene instantly changed his demeanor. A smile followed with a friendly allowance to Chachaa to enjoy his drink.

For a change, money could buy some genuine happiness. Chachaa looked satiated and went on his way muttering a shy thanks.

During my travels in Mumbai, I have had more than couple of instances when cab and auto-rickshaw drivers have gone out of their way to help / accommodate me. Once an auto-rickshaw driver let go of his fare because both he and I did not have requisite change. Another occasion I have been returned my laptop bag (containing passport and other extremely important documents,  apart of-course laptop) which I had left in a cab. And this after I had earlier chided the driver for asking me money upfront at beginning of ride as he wanted to get gas filled. I did earn a lesson or two from him on how to judge people all the while unable to meet his eyes as I said thanks.

While there have been bad eggs too, these fellows had left me with an undescribale sense of feel-goodness and added to my amazement about this place called Mumbai. Somewhere within me maybe today I spontaneously felt like repaying a small gesture to that often maligned community.

Wednesday, April 27, 2011

RoaDJ warriors

April 2011 was stuffed with holidays. The last one being Good Friday and along with it comes eponymous long weekend. By some stroke of universe forces, I found myself on my way to Shirdi.

This was my second visit to Shirdi. This time around, both the config of demography (former - friends, latter - family and elders) of our entourage and mode of transport had changed (former - train, latter - SUV on road). The combination to give an altogether different experience than last time.

Riding by road all-night called for someone willing to take a seat next to driver and be very determined not to fall asleep. Given the config as told earlier, the onus surely and squarely fell on me. I haven't put up an all-nighter in a long time. Adding to the difficulty level of this task was the absence of any fitting music to keep both driver and me awake. Somehow driver had managed to carry with himself CDs of only ghazals. Little after 2am, sleep stealthily approached me with silent Ninja steps aided by the intoxicating deep-voiced Urdu of ghazals For some 15min in real time (and half a second in sleep time; and I think Nolan got it diametrically opposite in Inception), I doggedly dodged the Ninja's claws; just slipping out each time when it had me in its grip. But this dodging business was no help me survive till dawn. 

I fished out my MP3 player to rescue. It had some peppy dance numbers from yesteryears (circa 2000-2008 AD) stored in its never-forgetful memory. Now, the part to make it mate with the vehicle's music system. Like some couples who aren't meant-to-be, this duo also could not get it along though they both needed each other. What next? I brought out a pair of Creative EP-630 inside-the-ear earphones and attempted to do a share-ware. EP-630 plugged in MP3 player and its two dangling ear-buds doing an Avatar-esque sahelu between me and driver. The road warriors got an ear-bud each. One ear taking in sounds of the long dark (k)night (I just couldn't resist writing this) and other ear hearing cymbals and electronic bass. 

Now the show was on. I wanted to show-off my music collection and be a bit of DJ as well. So, I appeared to furtively click controls of MP3 player to show that I was customizing the music for my driver. In reality, all I was doing was turning the Shuffle mode ON and controlling volume in real-time. I was hoping that this would make a big impression on our driver. Well, some two hours later and lot of thumb twiddling, we managed to successfully keep the Ninja away with our Hatori-Honso-Samurai-sword-music. Being very near to our destination, driver decided to stop-over for tea for that last mile push. Over tea, I went into a chit-chat with him. He wryly said, "Return journey mein phir se yahi gaane mat bajana, kuch achcha aur nahin hai ismein?" There went my hope of being a good DJ (or human equivalent of www.pandora.com) into Recycle Bin. Maybe I will Restore it for more accommodating pair of ears and music taste.

Tuesday, April 26, 2011

The happy Facebook world

The world as it exists on Facebook is almost utopian.
  • Every person looks the best they could and always smiling in their photos
  • Somebody is traveling to Antarctica, somebody is skydiving, somebody cooked dinner with friends, somebody went to underpriviliged children's school, somebody just hung out with buddies
  • Somebody is getting married, somebody is having a baby shower, everybody comments "both of you look very good together"
  • Nobody feels jealous of anyone, every one "likes" what others are doing
  • Flame wars on political debates, religion etc die down even if some renegade has the guts to bring it up
  • Nostalgia rules, old photos of childhood, forgotten songs are all sprayed over
  • Very few people seek angst or existentialism, even when they do -- its subtle. A coded message here, a small poem there. And it doesn't disturb the fabric of this utopian world.
  • All smiling faces, everybody's life looks content with no worries
There was a time when movies sold us dreams. Its now our friends through their profile photos.

LOST and found

I am done with LOST. Completed the series yesterday night. I had earlier watched complete run of X-Files and Chanakya during 2007-08. Did watch Prison Break simultaneously as it was being telecast. I am keeping the game up with Fringe in similar manner.

Season 6 Finale of LOST was a decently satisfying end to the series. Much better than what X-Files had offered. Though I will always root for Mulder and Scully, the emotional connect with Jack, Hurley and Locke was much more deeper. 

Running with LOST made me take break from watching movies. Can't pursue both along with other priorities on my time. 

Monday, April 25, 2011

Rate My Life

The Internet knows everything. So I asked it to tell me how does it view my life (given that I spend a great percentage of my waking life interacting with The Internet)? Like a great counselor, it asked me some pointed questions. And then replied with Yoda-like wisdom:


I never imagined that my "sins" would outdo my "virtues", and that too by a good enough margin to cast any doubt over my leanings. :D For my accomplishments, Yoda had little to say. He is waiting to see what I do next.

Wednesday, April 20, 2011

Raw Deal


Learning to "deal" (as in transactions with business / monetary value) is fraught with having to go through emotional hammering. Well, "dealing" in personal life and relationships is not any easier also.

Suppose you go into a negotiation where you are squeezed out. The other party holds cards which impact your long term return. And the party knows that. Then, during intermediate level milestones, they wring you out by getting leverage on those Ace cards. You know that they are dealing it all unethically and unfairly. You cringe under your skin, your blood boils, your eyes want to turn daggers. And yet you let it go. You let them do the unfair thing. Let them bite into you and hold your head feigning dignity while in reality you have been shafted hard from behind. You grind your teeth and bite the steel. All for what? To protect your long term interest.

Can there be a time where loss of dignity or accepting grossly unfair intermediate negotiations becomes unbearable and one walks off the table giving damn to the longer term interest? How much is your stomach to digest all that is coming your way while concentrating on that fuzzy future pay-off? Do you take the call to tighten up your spine even when you know that you don't call the shots on this one? Do you bide your time for evening the score when you get an upper hand?

I am learning the hard way to hide my emotions when I get shafted like this. Probably I add a little more to the pleasure of the other party when they see me seething but unable to act upon it. Its tough to walk away with an air of dignity after getting looted. What do you portray - "it does not matter to me", "it shows what is your character and suits you well", "this is a trivial amount for me; I put it in your bowl as charity and I pity you that you squabble for such amount"? Or do you portray - "I am a good loser, hats off to you for playing this one to the 'T'"?

Grind, grind, grind my teeth. But unable to walk away from the negotiation. Longer term interest is the dangling carrot. Should I learn start playing poker and learn the black art of bluffing the other party into believing that I have a better hand than theirs? Lamentably, I mostly deal with open cards. And that is not how this game is supposed to be played.

Friday, April 15, 2011

Why code?

"I advised my sister to avoid software companies. Told her to try consulting companies. She anyways has to do MBA 1-2 years from now. Software companies will make her do coding." - A colleague referring to her younger sister studying at a top-rung NIT.

Another silent jab endured politely. Well, you can't tell someone else to change his/her point of view on such a subjective issue. Like Delhi vs Mumbai debates.

Google, Amazon and the likes now visit campuses at NIT. When I was in undergraduate, such treatment was reserved only for IITs. Seems now IIT students prefer to go to Goldman Sachs and Morgan Stanley rather than Google and Microsoft. Hence these software firms may have revised their recruitment policy to fill in their hiring. Some labor market dynamics this is.

So, why have these firms fallen out of favor? Is it because NPV of salary + bonus benefits of Google India is lesser than that of trading desk of Goldman Sachs? Or is it because it is now perceived on campuses that coding at Google is not as good a work content as that of making presentation decks in IBD of a foreign bank? My sense (stemming from historical observations) would give more credit to former reason.

And here we are not even comparing an Indian software services company vs foreign bank IBD. I am talking about Google, Amazon, Yahoo, Microsoft.

I guess it is more an emotional issue for me than an objective one. I have revered these firms. Why? Because some part of felt God-like to write code. I put some considerable effort to name that experience which satisfies pleasure-reward center in my brain. And answer was made of 2 parts - "problem solving" and being able to afford laziness.

Problem solving would mean getting a kick and satisfaction after finding a robust solution for a problem which can be dissected into logical steps. Even where there is no apparent approach available for dissection into logical steps  (e.g. fuzzy logic), still developing heuristics which give reasonable results statistically. You can model sea-waves, smoke trails, light reflections, inference user intentions --- you can model nature and universe.

Being able to afford laziness is that you can automate tasks which are routine. This frees up time for being lazy or delving more into the core nature of problem rather than going about doing mundane work daily.

While I discovered these 2 aspects intuitively from my own experience, it was a huge satisfaction to see same conclusions coming from uber-Hacker Eric S. Raymond. A sense of validation coursed through me.

But what is so special about this? Can't you model complex financial transactions and be lazy by automating trading? These applications very much exist in real world business and finance software. Yes, they do. And this is where I still am confused. Why would I appreciate coding more for a web-search engine vs modeling Black-Scholes? What is the difference?

Maybe it comes from some deep antagonism towards profit-centered capitalism and vices of money. Do I hate money or don't want it in my life? Definitely not. I have reasonable aspirations and I do enjoy pleasures money can bring. Yet, invariably one starts serving money rather than other way round. Its that spirit of hoarding information and employing greater-fool theory in business transactions which possibly goes completely against the grain of hacker spirit. Like the infamous open letter of Bill Gates to Homebrew Club hobbyists.

And then I have had some lessons learned from Talisma days. Great product, we believed itself. We enthusiastically coded for it. Awesome working environment, freedom etc etc. It went bust. What happened? Did Product Management team failed to see market trends? Did Marketing and Sales goof up? The fact of the matter is that a great engineering product too can fail if business side fails; either by its own doing or failing to ward off excessive force thrown in by competitor (Netscape vs Microsoft, uber example). We all need breads on our tables. We all need to go out on those holidays. We all aspire to have a home with modern amenities. We want to give our kids a bright and secure future. These all can only be bought by money and not by any idealism. But is it required to fool the customers through marketing gimmicks, to wear the smiling-face when facing investors? Sadly, answer is yes. The system that enables movement of capital is so structured that there is no escape for all these pretentious vices of business side of things. Practically, I can only try to keep getting minimally involved in it.

Minimal involvement means not taking up managerial positions. Not being responsible for P&L. They wont let you have that. Maybe you yourself cant have it, when you see peers and juniors moving up to become your superiors. That competitive animal inside you, will it accept this?

Such is the nature of these thoughts that they navigate laterally rather than top-down.