Sunday, March 11, 2007

Learning Lisp: Part I


I come from a school of 'programming education' vis-a-vis Arizona State Univ (go Devils!!, yeah like I care what a lot of not-going-to-be-educated guys are doing with their balls: football, basketball, or any of those other *balls). In my time it went: learn procedural programming (pascal or c), struggle with it and your comatose classmates, learn data-structures, learn OO, learn the ideas of "Software Engineering", do a couple of lame projects, and then "Congratulations" (big hand shake) now go get yourself a job.

My personal program didn't go quite like that cause I took an "internship" in 1998 with a startup company in Sunnyvale that got bought by Netscape who was, two weeks later, bought by AOhelL. After all that fun I got laid off in 2001, which meant it was time for me to go back to ASU to finish my education. I went back and found myself in the same ole drudgery as before.

When I started at AtWeb in 1998 I started begining to see why they taught us some of the things that they did in "CSE 345: Theory of computer languages", as much since as it *didn't* make when I was in class. When I started working I was like "WOW, there was a reason for all of that stuff".

I'm getting off of the topic of "learning lisp" and I'm going to continue with it. I'll call the part where I actually start learning lisp "Learning lisp: partII".

I'm not one of those folks who started learning how to program before they were out of their diapers. I'm not one of those folks who was programming RPGs in highschool instead of making friends and experiementing with drugs and alcohol. I started learning how to program in my sophmore year of college when I decided that mech-eng was not for me and my dad pursuaded me to go into CS instead of the English or poly-sci thoughts that I had going on in my head at the time.

So yeah, I'm a smart guy, mathematically-minded and all, but my intro and continuing education of programming, in retro-spect, was crap. And most of the classes that I took after that were crap too. After a couple of semesters of c and pascal, we had a class called "Survey of programming languages". It consisted of 3 weeks of ada, 3 weeks of lisp, 3 weeks of prolog, and 3 weeks of, shit I don't even remember what it was. I can tell you that the class was *worthless*. 3 weeks of lisp had all of us going "cdr-who-what-when-where?", "why recursion when you have while and for?", "why lists when you have structs?", "freakin recursion doesn't even make any sense anyways!" Did we get answers to any of those questions? NO. Did our prof ever even try to tell us why this might be of interest? NO. We just all cheated off each other and did what we had to do to pass the class. Don't even get me started on the 3 weeks of prolog! That was as concrete as a 400 level philosopy class, though nicely bundled into 3 short weeks.

Fast forward several years... (though still 2 years back)

I've been a professional programmer for close to 10 years. c, c++, java, perl, tcl, php(is that really a programming language?) I've worked with them all in that expanse of time. I think that I'm at the top of my game. I've dealt with OO since they were still getting the c++ STL nailed down, trying to figure out the craziness of perl OO, through the many different versions of java since 1.0. And then..., I run into the most beautiful of things that I've ever seen: ruby. I started at home, by myself, like most addicts, but I had to take it to work to really start the downfall. I'm reading all the ruby mailing lists, websites, etc., loving it, thinking that I'm on the cuttingest of cutting edges.

However, in the background of all the ruby love there is the background noise about how 'ruby is part this and that and part lisp'. As I get more into the the daily ruckus of ruby, I'm starting to find all of these references to "functional programming". I'm thinking "yeah, thats that crazy non-sensical Lots of Irrititating Silly Parenthesis shit that I had to deal with for a mind-numbing 3 weeks back in college". Why? (thanks for so much Mr. Why) Why deal with all this non-sense when procedural/OO languages do it all so much more easily? As I tread deeper into the ruby waters, words like haskell and ML and erlang started coming up. Again, why? Ruby is perfect, why do all these folks keep stepping back into this backwards mucky world?

I'm a smart guy, but no einstein, I figured if all these apparently "really smart" guys keeping going back to this muck, there must be something that I'm missing. So I started looking into haskell and erlang. Though I could see some advantages, (and LOTS of disadvantages) I really couldn't deeply understand what the hell their code meant and why the hell it was so great.

About 4 months ago I came across a posting on anarchia that pointed to an introduction to programming book with scheme that was freely available in PDF form. At first I thought "meh, the last thing I need is to learn how to program again", but I also knew that if I was ever going to really grok any of this haskell/erlang shit I was going to have to really understand functional programming. I decided to do it. To go through the book, page by page, example by example, as a beginner and re-learn "how to program".

My next handfull of postings will be about my "re-learning how to program: with scheme".

No comments: