It's 5 minutes until midnight on 8-8-08 as I begin writing this. I just woke up. The weather is surprisingly cool (60F) for August; it's nice. I haven't blogged in a while, I sort of decided it wasn't really my thing, and Blogger being such a P.O.S. hasn't made me very eager to use it frequently.
Anyway, The Dream.
I had The Dream this evening. For those who are not
xkcd readers who commit every strip to memory, The Dream--as I'm calling it--is a profoundly revelatory dream relating to functional programming.
xkcd #224 deals with the author's eye-opening experience with
Lisp, mine happened to be with
Scheme.

I used to just like this particular strip because of how it presented Perl as the glue that actually holds it all together, now I've got a whole new appreciation. This particular comic is both funny and deep.
Around 2006/2007, I started to get a bit more serious about programming and wanted to break out of much of the lameness that writing the same sort of
.NET code for financial transactions at work was bringing on. I decided, based on a lot of the reading I'd been doing, that I needed to give
functional programming a go. I never went past my sophomore year at UW-Madison, and subsequently wasn't exposed to functional programming, assuming it's even part of the curiculum, and had been largely locked into the
imperative procedural and
object oriented programming paradigms, with a bit of the "a ha" that comes from getting your head properly wrapped around
SQL.
Anyway, moving into 2008 I acquired a copy of
Guy Steele's
Common Lisp the Language, which introduced some interesting stuff, but wasn't really framed correctly for a novice trying to learn the language. I've subsequently found out that it's generally accepted that CLtL is more a book targeted at implementors of Common Lisp. I read that book here and there, for a while, but given the nature of it, my interest faded a bit.

Enter: Peter Siebel's
Practical Common Lisp. This book is
available for free online, and I read the first 3 chapters there. I so enjoyed how practical (surprise, surprise) the book made Lisp seem, and how it dove right in to writing code (which made it fun), as opposed to swamping you with mathematical theory (which is interesting, but not so much "fun"), that I ordered a copy. I got setup with a
SLIME environment and spent a while working through some of the chapters in the book. It was fun, but slowly, I started having some questions, and found I was not getting some fundamentals really "in" my head, and as a result, that project went a bit by the wayside.

I tinkered a bit with
Haskell a while back, and it looks neat, and I may explore it more later, but again, I didn't really stick with it. Then, a few weeks ago I was reading about
The Little Schemer, which I'd heard of but never really explored. I have a friend who related some of his painful go with
Scheme when he was in college and as a result of that, I never had the motivation to check the language out. I recently came across
The Little Schemer on
Google Books, where it had a few chapters available, and I started reading. I was immediately grabbed by the book's writing style, which was formatted mainly as two columns of question/answer Socratic dialog. The book approached the language, and the ideas of programming, from a somewhat abstract direction I hadn't previously seen. There wasn't a focus on the heavy duty use of the language, or of the history which lead to the language's creation, or even an acknowledgment that what you were reading was a programming "How To". The book just presents the theory of some of the basic building blocks of Scheme (car, cdr, cons, etc) in a simple, whimsical way, and begins giving examples of using those blocks to manipulate
lists. You're learning to program without realizing it; it feels like game or a puzzle. Before you know what's happening, you've got a vague notion of
S-expressions, and subsequently, atoms, lists, and how you can use them. You're still not
doing anything meaningful, but at least for me, there's a sense of something powerful.
Suffice it to say, it's a good book, and I'm currently only 25 pages in.
Anyway, back to The Dream.
I was reading some of
The Little Schemer on the porch today after work while drinking a lightly hopped adult beverage and was getting tired. I went upstairs and ended up laying down on the bed. Sometime before 9pm, I fell asleep.
The next thing I knew, I woke up, and had had this bizarre, epiphanous dream. Much like the xkcd comic, the whole tree like, nested lists of Scheme had suddenly clicked and it was as though they made perfect sense and as a result, made the whole world make a bit more sense. It was an experience on par with the sort of eye-opening effects one might get from a strong psychoactive drug. I actually laid in bed in the dark for a bit, trying to process everything from the dream. Slowly waking up and making sense of of it was an ongoing surreal experience. This was as close as I feel I've ever come to anything approaching a religious or spiritual experience. It was really that intense. I'd try to relate the substance of the dream, but it lacked any real narrative, and my putting it into words would likely water it down and fail to convey what it actually
said.
There've been a few times in my life--the bulk of which I've now been programming and/or learning to program--that I've had a new understanding that really shifted my perspective. Offhand, I'd say those previously were:
1. First learning programming with GW/QuickBasic and seeing the power of code emerge (sometime around 1990, OMG a loop!?).
2. Taking a data structures class in 1997 (my freshman year in college).
3. Starting to learn Perl in 1997.
4. Beginning to really grok regular expressions (sometime in the early-mid 2000s).
Now, there's a 5th item on that list:
5. Reading The Little Schemer, and beginning to see the elegant simplicity of functional programming.
I've only now been acquainted with Scheme and
The Little Schemer for about a week--and I've not yet written a single line of code!--but they've already got a familiarity and affinity for me that's taken years to build with other languages/books, like Perl and
Programming Perl.