Saturday, March 21, 2015

Evolution of Lisp (barely into Chapter 1)

So, the week was busy, and I'm finally getting back to SICP. I feel there's a certain type of energy required to maximize appreciation for this book, and it's a type that I probably won't be in all the time, so... This may be slow-going.

Anyway, there's a quote in the book that I found interesting (I'm snipping out some bits, and adding emphasis):

"Lisp's informal evolution has continued through the years.... This evolution, together with the flexibility and elegance of the initial conception, has enabled Lisp... to continually adapt to encompass the most modern ideas about program design."

I see this as something that must continue. Luckily, I also see it as something that is continuing, if perhaps at a slower pace in some ways than one might hope for.

I was having a discussion the other day that's pertinent to this, as well. We were talking about different lisps, and different other languages, and what they each have to offer. An observation was made that one nice thing about Clojure is that it has added some ways to express certain other data types (vectors, maps, sets) as literals. Indeed, I see this as a potential (and potentially huge) win. And of course, it's possible in any lisp that supports reader macros[0] to add this to said lisp. But still, it's valuable, I think, to have the form of it be a de-facto standard, whether or not it's a Standard.

And I'm starting to think that the "standard" aspect of Common Lisp may be a hindrance to its progress. To its evolution. I could easily be wrong about this, in various ways. I do think, though, that a strict adherence to the standards presently available in whatever language does risk nipping in the bud what could otherwise become some beautiful flowers of joyous new forms[1].

One thing I dislike about Clojure, and I admit this may be an unfair bias, is that it runs in the jvm. Which is really more about the j than the vm: I kind of hate all things Java. There are some good reasons for this (a complete lack of metaprogramming capabilities[2] is certainly a problem with blub[3] — I mean Java), and likely some bad ones, too (like that I've decided I hate it and therefore often I'm unwilling to even look at it to see what useful things might be there – like, perhaps, the jvm??). Still, that's where I'm at at the moment, and while I'm open to the idea that my viewpoint might change, I'm currently thinking: What if someone wrote a Clojure core-language implementation (I know we'd lose any libraries that are front-ends to Java libraries, though I hear that many Clojure libraries are, in fact, pure Clujure, so I don't know how much we'd actually lose?) that compiled down to, say, llvm code, to then run on a variety of platforms as native code. I think if that existed today, there's a good chance I'd drop all reason for caring about Common Lisp. (Then again, does Clojure have conditions and restarts? It would seem not; nor reader macros! Pity.) As it is, I still may well get around to exploring Clojure more at some point. Or maybe I'll just read up on some of its literals, and see what I can do about implementing them as reader macros in CL (that is, Common Lisp)?

Of course, for the purposes of SICP, I'll just stick with Scheme for now, since that's what the book uses. Which brings me to a question: Is Scheme still actively evolving? I think it might be (for example, I think s7 might be relatively new, as these things go), but I don't really know.  And anyway, there is, again, a standard.  Or 6.  Or 7 or 9 or something.  Hmm, I guess that's a sign that it's continuing to evolve?  Well, good.

Final note: I'm now up to page 17.  Nothing quite inspired me to write yet another post since that tidbit on page 3, though there is some interesting stuff.  More to come on chapter 1, I'm sure.


[0]  is that any lisp? I don't know! Must find out.  I know it certainly applies to Common Lisp, as discussed later.

[1]  Forms, get it? It's a lisp joke. Groan at will.

[2] To link to but one of Steve Yegge's posts that have influenced me away from Java – and towards Lisp(s).

[3] Another influence of mine is Paul Graham (sigh, all the white guys[4]), and "blub" refers to a paradox he presents in an essay called beating the averages, also described in brief on wikipedia.

[4] If anyone knows any non-white and/or non-male people writing about Lisp, please point me at them!  I'll probably go on a hunt at some point, too.  Because, you know, diversity is good.  And I'd love to think I could apply the diversity challenge to my programming books.  Can I??

Sunday, March 15, 2015

Fun at the front!

So, here were my main take-aways from the front matter of SICP:

  1. Programming should be fun!
  2. Computer Science is not necessarily about computers, per se, and is not necessarily a science;
  3. Instead, it's all about thinking in precise ways about expressing ideas about how to do things.
  4. Also, lisp is cool.  ;)
OK, it didn't quite say that last one in so many words, but... perhaps with prior bias, that's still my take-away.

More to come.  Chapter 1 is up next!

Saturday, March 14, 2015

Welcome to my journey through SICP

I've been here before, but it was different.

For a long time, now, I've been interested in learning more of the sort of "computer science" side of computer programming.  The actual theory of things.  Well, the Structure and Interpretation of Computer Programs (often referred to as SICP, which I pronounce like the word "sic" followed by the letter "p", in rapid succession) is a book that, as I understand things, is meant to help one learn such things.  And some years ago (circa 2003 or 2004, while working at Amazon), I became aware of and interested in it, and I set out with some coworkers to go through it and understand it.

Well, we got through a chunk of it, but we were having trouble getting ourselves to stick to even the fairly relaxed schedule we'd set for ourselves, and... eventually, interest waned enough that it didn't feel practical to proceed, and we aborted.  (Or maybe it wasn't that interest waned, but that other things took priority.)

Well, it's... wow, almost a dozen years later, now, and I've been meaning to get back to this (because my interest never really waned, I just was having trouble sticking with it with all the other stuff that was going on), so, now I'm going to.  And not unlike the various cooking blogs that follow some book or other (famously Julie Powell tracking Julia Child (inspiring the film Julie & Julia), or, less famously but closer to my awareness, an online friend of mine Cooking [his way through] The Prawn Cocktail Years), I thought I'd blog about my traversal through SICP.

So, this is the beginning.  Well, maybe it goes back a few months, actually.  It was back in mid-november that I ordered a copy of SICP from the local technical bookstore (DigitalGuru, which was local to me at the time).  I'd looked for it on the shelves, and they hadn't had it, but they were willing to oblige me and order a copy, which I picked up some time later.  I read through the front matter, and started in on chapter 1.  And then I put it down.  I'd gotten as far as page 12.  I was excited to proceed, but life was also a bit chaotic for me at the time, and I got distracted from it.  But now I want to get all the way through it.  And I figure the best way to do that is to... start over?  Well, OK, I'm a bit reluctant about that, to be honest, but it's what I'm going to do, because I figure I want to blog about the whole experience, and I don't remember the front-matter well enough to know if there was even anything I might have wanted to say about it, had I been blogging about it from the last time I started.

So, here I am, on "pi day" (hint: pi is still wrong, and anyway it's kind of really tau day), and I'm going to start over.  I'll post small posts as I make progress on my way through, and longer posts when I find something that seems particularly interesting – either because I've learned something, or because I've been re-exposed to something I already knew but which I think others might find useful, or whatever.

I may or may not have a co-worker roped in on this, too.  Anyway, more to come.

Oh yes, and I will be using scheme as I go through this, as that's the language that's used in the book, and I've been interested in lisp dialects (of which scheme is one) for some time (not insignificantly because I like the idea of beating the averages).  I think when my little group of coworkers did this at Amazon we may have tried to convert things into some other language.  I think that was probably a mistake, and may well have contributed to our falling off the wagon.

Will I fall off the wagon this time?  Oh, quite possibly.  Life is still interesting.  But my hope, with this blog, is that I can get back on, and pick up more or less where I left off.  I make no promises as to the pace of this progression.  My goal, though, is to ultimately finish.

I also anticipate sharing whatever code I write for the exercises (with commit history and everything) via github.  I'll post an update when that exists.  Who knows, I might even dig out a previous repo... I think I might have one lying around.  OK, off to look (and start reading).  More to come.