Archive for September, 2009
As you might recall, Liquid is my attempt at writing a Lisp interpreter, with the purpose of exploring some ideas I have had for a while, and to eventually produce a system that can be used to write non-trivial programs.
That last goal took a serious hit the other day, and I’ll have to go back to the drawing board. The core interpreter, as it stands, is simply too slow. I know, premature optimization is evil and all that, but if simple evaluations take several seconds, it’s probably time for a critical look at the design, at the very least.
For example, I had a range function, defined like this:
(define (range n) (define (range-aux n acc) (if (<= n 0) acc (range-aux (- n 1) (pair (- n 1) acc)))) (range-aux n ()))
(A Scheme version would look much the same, except pair would be called cons, and the empty list would be written as ‘(). None of the more interesting features of Liquid are in this example.)
(range N) produces a list of numbers from 0 to N, e.g. (range 5) gives (0 1 2 3 4), etc. As it turned out, this function was horribly inefficient; (range 10) needed ~3000 “evaluation steps”, and (range 1000) took over 13 seconds to complete.
As it turned out, the major culprit was <=. I foolishly figured I could implement = and < as built-ins, and derive the other comparison operators from that. So <= was defined as
(define (<= a b) (or (= a b) (< a b)))
This doesn’t look so bad, except that or is written in pure Liquid as well, and it’s pretty damn slow.
Rewriting <= to make it a builtin was easy, and made range much faster. This didn’t solve the general problem though; one of the big ideas of Liquid is that you can write “syntax” like or, and, case, cond, when, while, etc, in Liquid itself, without using macros. (Not to mention, all kinds of other stuff.) While it does work, apparently it makes code unacceptably slow. :-(
The way an “evaluation step” currently handles code and figures out what to do next, is hairy, partially due to the way rest args and keyword args are handled. I am now thinking of doing a rewrite with a different way to handle delayed arguments. Hopefully that will be faster…
(The implementation language for this version is D, by the way… so I was expecting more speed than with the Python prototype.)
(P.S. For whoever is interested, the current version of the interpreter can be found here.)
When searching for odd domain names, I found this: www.la. That by itself isn’t so odd, except that .la is the domain name extension for Laos, while this site is pretending it stands for “Los Angeles”. “LOS ANGELES is the world’s first city to be awarded its own unique internet address: .LA.“
I suppose a name has whatever meaning people assign to it; it seems a bit misleading though.
I’m thinking of becoming an ACM member, mostly because I want access to the digital library. The price, however, is a bit steep: $99 for professional membership, then another $99 for the library. (Discounts don’t seem to apply to me… I’m not a student, nor a member of any SIGs, and Florida is probably not on their list of developing countries. ;-)
So now I’m wondering, does anybody here have experience with this? Is it worth it? (I’m mostly interested in access to papers about programming languages. Of course, access to books and courses doesn’t hurt either, but the papers are my main concern right now.)
Interesting: This site shows maps of what the earth would look like if the water level would rise. (The site’s default, +7m, would flood half of the Netherlands… a fact of which the Dutch are very aware, by the way.)
It’s good to know that I’m not the only one who has a problem with Mac design going to from colorful and friendly to cold and boring.
“I’ve spent the day eyeing Leopard warily from my chair and web-surfing for skins, icons, and suchlike. There’s a *whole* lotta grey goin’ on there, and I’m trying my designer-y best to neutralize its depressing effects by altering what I can in the options allowed, but I cannot help but wail and gnash my teeth and remember the good old days of Kaleidoscope.”
“Now it seems to be all about conformity. What happened? Toolbars? Any color you want as long as it’s dark grey with a really dark grey but not quite black tiny little font (Hello? Readability? Not. And don’t get me started on the light grey on white documentation and website.)”
“I mean, c’mon… flat grey folders? Screaming blue menu highlights? What happened to that happy, glossy, candy-colored interface that made things look happy and fun instead of like the inside of a cube farm asylum?”
Tja. I’ve been wondering the same thing myself. I actually loved the looks of OS X when it first came out. This was in the time of the original iMac and iBook, which came in a variety of colors, and were curvy rather than blocky… very different from the beige boxes that were all too common back then. The design of OS X mirrored that: colorful blobs of goo for buttons and scrollbars, translucency, pinstripes…
Then at some point they [*] decided that everything had to be be flat, grey (or maybe black or white in the case of laptop cases), minimalistic, and (IMHO) boring. Maybe in an attempt to look more “professional”, I don’t know. Some people I spoke to seem to equate professional with unexciting and colorless, so yeah. (One exception is the iPod Nano which, in the latest wave, comes in a number of bright colors. Maybe because an iPod doesn’t need to look “professional”… :-)
Unfortunately new releases of OS X mimicked the hardware as well, and it shows. Apparently even the little apple and Spotlight icon in the menu bar had to get the black-and-white treatment.
Whaddya think? What is the reason that Apple design ideas have changed so much? And will they change back someday?
[*] Assuming that designer Jonathan Ive was responsible for both the iMac/iBook design and the current flat/metallic design, maybe there’s hope that Apple will get a taste again for non-boring designs someday.