Skip to main content

Posts

Showing posts from February, 2008

Scheme: Procedures vs. Data

I'm going through Structure and Interpretation of Computer Programs right now. One thing Abelson really enjoys is blurring the distinction between procedures and data. Coming from other languages with higher-order functions, I'm comfortable with the idea. For instance, I understand map, filter, reduce, etc. However, he takes the idea much further. He's just as likely to put a bunch of procedures into an abstract data structure as he is to put data into an abstract data structure. Since procedures can carry with them a bit of data via closure, it all works out. Even he calls such procedures "objects".

He loves to mix up data and procedures, because he says it "doesn't really matter." Thinking about that, that's somewhat true and somewhat untrue. Clearly, procedures can be passed around as data, and that's fine. However, there is a difference.

If a procedure takes a value and returns a value, you can think of that procedure as data wit…

A Hybrid World of Open and Closed Source Software

Open Source Was a LieOkay, now that I have your attention, let me explain what I mean. Part of the promise of the Open Source movement was that it would produce higher quality software. Looking back, it's clear to see that this isn't always true. It turns out, there are many examples on both sides. Sometimes the open source option is better, and sometimes the closed source option is better. For instance, Apache is far more secure and robust than IIS. Linux is far more reliable than Windows 95. On the other hand, Photoshop is way nicer than the GIMP, and my Java friends have told me that Intelli J IDEA is nicer than Eclipse. I've even heard that Solaris still beats Linux when it comes to NFS robustness.Stallman Was Right All Along (It's about the freedom, baby! Yeah!)Stallman actually predicted the above. In the early days, he was pulling his hair out screaming, "It's not about the quality! It's about the freedom!" That's why I now put …

Scheme: Implementing cons, car, and cdr

I'm going through Structure and Interpretation of Computer Programs per the recommendation of my buddy Mike Cheponis. I'm really enjoying it.

I always thought cons, car, and cdr were so low-level that they had to be builtins. However, interestingly enough, SICP shows how they could be implemented using a closure:(define (my-cons a b)
(lambda (pick)
(cond ((= pick 1) a)
((= pick 2) b))))

(define (my-car x) (x 1))
(define (my-cdr x) (x 2))It's kind of silly, but it also works in Python:def cons(a, b):

def list(pick):
if pick == 1:
return a
elif pick == 2:
return b
else:
raise ValueError

return list

def car(list):
return list(1)

def cdr(list):
return list(2)Neat!

It's easy to see how to extend this in Scheme to have "objects" with any number of memebers, although I'm sure it's not very efficient.

By the way, I really like DrScheme. It's relatively modern and very friendly.

Books: The Myths of Innovation

I just finished reading The Myths of Innovation. It's a short, enjoyable read, and I recommend it. I kept track of some of my favorite quotes:

By idolizing those whom we honor we do a disservice both to them and to ourselves...we fail to recognize that we could go and do likewise. -- Charles V. Willie [p. 1]

Freeman Dyson, a world-class physicist and author, agrees, "I think it's very important to be idle...people who keep themselves busy all the time are generally not creative." [p. 12]

As Howard Aiken, a famous inventor, said, "Don't worry about people stealing an idea. If it's original, you will have to ram it down their throats." [p. 59]

As William Gibson wrote, "The future is here. It's just not widely distributed yet." [p. 66]

[Alex F. Osborn wrote about finding ideas:]Produce as many ideas as possibleProduce ideas as wild as possibleBuild upon each other's ideasAvoid passing judgment. [p. 92]Jobs explains, "I'm convinc…

Computer Science: Offset-based Linked Lists

Note, I'm speaking a little loosely, and I'm not a C expert, but I think this post is still interesting nonetheless.

There are many ways to "architect" and implement lists.

These days, it's the norm in languages like Java, Python, etc. for the language or language library itself to provide a list implementation. You simply create a list and then start shoving objects into it. Python, Ruby, Perl and PHP all provide native syntax for lists. The algorithm used is more sophisticated than a singly or doubly-linked list because lists must double as arrays in those languages. Java and C++ have native arrays and array syntax, but they also provide a variety of list implementations in their libraries. Both can use generics to constrain the type of objects you put in those lists. One thing to note, however, is that there's a distinction between the list itself and the items in the list.

Since C's standard library doesn't provide a list implementation, a vari…

Personal: Intentionally Unemployed

Yesterday was my last day at Metaweb. Metaweb's a great company, and I enjoyed my three month stay there, but after finishing the work I was working on, I knew it was time to take a break.

I've worked at five startups in a row. When I left IronPort, I wanted to "see the world" and see new ways of writing software. I've had a good time, but it's taken its toll on me. Six months ago, I was learning Ruby on Rails, doing a Facebook startup using it, and trying to take care of my family as my wife gave birth to our fourth child. You can see why I'm kind of burnt out. I'm hoping to take a month or so off.

I've now been doing Python Web development on Linux (on and off) for about seven years. When I started, there were few Python jobs, and I was the only one at my company who insisted on using Linux for his desktop. There was no OS X. Everyone used Windows. I was coding in PHP working with the author of the first book (which had just come out) on…