2010 m. rugpjūčio 8 d.

Road to start learning Lisp

First English (Bad English. "All your base are belong to us" kind of English) and first geeky post. Yay!

It is long journey. Not learning scheme -- that is easy and short one. (Seriously, it is). But starting learning lisp is not. It takes long time. It took two years for me and I'm not slowest learner in the programming world. It is hard to start learn lisp (or scheme) -- it's like denying something important. For example, in school mathematics teacher always told us: "You can't take square root of negative numbers". You see, we are not suppose to learn complex numbers in school, so they do not teach us. Instead of explaining, they tell YOU CAN'T. And we couldn't. We thought that it was some kind of math laws. You know, like "division from zero has no meaning". So, one day you can not take square root of negative number. After that you go to university and bam! Now You can take square roots of negative numbers. Your brains fights against itself -- it is hard to remove "learned laws" from Your head.

So, lets move step by step. First, it was Paul Graham. I found his essays quite late. I start reading them. It seems like a clever writings. And than a stepped on an essay praising Lisp. "Ok, he seems like a smart guy -- I should check that Lisp thing": I thought. So I did. And I start laughing -- that was stupidest programming language. "This guy is not as clever I thought": that was my response and I went back to my imperative ways.

After half year, I found Steve Yegge. This man can write interesting geeky essays (blogs, articles, whatever...). You know, You read them and somehow You think that is Your thoughts -- You become some annoying fanboy without knowing that. And again, I stepped on some posts of him praising Lisp. "Interesting, it sounds familiar. That Lisp thing. Maybe, I should learn that language". Next thought was: "F**k, not this retarded language again. How come, everyone who seems like smart programmer is actually not so smart and likes that horrible thing, they call Lisp.". So, another try to learn Lisp and another fail. But this time I had some strange feeling. You know that rule of thumb, when everyone around You seems like an idiot. It is hight possibility that You are idiot -- not them.

Half year forward. Eclipse, NetBeans and other monstrous IDES starts to annoy me. They and fact, that I could not understand jokes about Vim vs Emacs on slashdot. So, lets learn Emacs! I tried and I found that You can customize it with elisp. And You know -- it did not make me angry or made me quit learning emacs or learning elisp. elisp (or lisp) at that time still looked like a weird thing. But when You try to learn weirdest editor (The one that has tetris integrated in it) on Earth, at the end nothing seems not normal to You. So I was close -- I was starting to learn lisp (elisp). Than my little finger starts to hurt. Screw this. I have learned Vim instead.

My imperative ways started bore me. So, I spend around half year playing with various functional languages. And somehow stepped on idea that scheme is not pure functional language, but one can learn functional programming with it. And finally, finally I get it. I get it. I really start to learn scheme and I love this programming language. Like from XKCD comics -- I am enlightened. Scheme is awesome. Lisp is awesome. Current I am junior schemer with annoying fanboynism attitude. So, I am not going to try to convince anyone to try it or try to praise it's features -- I am not ready for that task (I am junior schemer, remember).

So two years have passed and I can code in scheme. This was my story.

And now some interesting stuff I have done while learning scheme. I have implemented scheme interpreter in python (Ok, ok... I agree. It is quite weird way to learn programming language -- write it's interpreter in other language...). Very small and very simple, but I even manage to implement closures and tail recursion.

There is project page:

And there is demo tool implemented in Google's AppEngine (My scheme
interpreter is pure python, so there was no trouble to make it work):