Archive for the ‘Lisp’ Category

So, yesterday I started looking at Amazon Web Services. I was getting tired of only writing code that required me playing with FFI and debating whether I should use UFFI, OpenMCL FFI, or CMUCL FFI in every case.

So, I decided to write a CL interface to AWS. Really, really simple. Mostly. AWS is pretty nice. It has a REST API, and Jonnay has been blogging about that lately.

So, maybe fill in the blanks … Amazon Web Services is a way that anyone (even all you people who aren\’t lucky enough to work here) can programmatically get tons of data from Amazon. I think Amazon Lite is the current best example of its usage. REST is a way of using HTTP to its full extent. Not just GET and POST, but also PUT and DELETE. A lot of people argue about its merits by comparison to RPC (eg, SOAP), but I\’ll leave that out of here.

The CL interface is coming along nicely. It is really quite simple, and 99% of the time I\’ve been working on it was trying to figure out why I kept getting 500 errors from my code, when the same query gave me 200 in a browser. The answer being that AWS doesn\’t like HTTP/1.0. Once I edited TRIVIAL-HTTP to use HTTP/1.1, everything went smoothly.

I wrote this one as I waited for the bus this morning. I mean, of course it\’s not very difficult to do a simple text transformation, but I\’m pretty surprised at the ease of writing WordPress plug-ins. And of course, it\’s only 90% done … there\’s still 90% to go. The 90% that would prevent other people who try to use it from hating me. I\’m never very good at that part. I\’m an itch-scratcher more than anything. Once my itch is scratched, I don\’t really think about scratching everyone else\’s so much.

Some of this works, like

sh: /home/pfeilgm/bin/enscript: No such file or directory

and now I can talk about DESTRUCTURING-BIND and even *FEATURES* — giving everyone some context, but there are plenty of HyperSpec pages that contain multiple definitions, like ECASE , which don\’t work yet. Also, I have to indicate whether it\’s a function, variable or macro … another reason that SchemeLanguage still calls out to me.

One of my favorite features of Haskell is its parameter patterns (yes, it\’s in ML, but I\’m not really the ML guy). They\’re a nice way to break down structures automatically, and to avoid doing conditionals explicitly. In an imperative language, you might have:

So, I\’ve gone pretty Lisp-crazy lately. Dunno why it suddenly grabbed
me after years of it just being on the sidelines. It\’s not just
Lisp, but it is primarily Lisp. There\’s also Haskell sitting there,
taunting me with its type inference. I briefly passed through Python
and Ruby phases on my way to Lisp. Fragments of those languages exist
in my environment — books on my shelves, a Python REPL on my cell
phone, and pieces of code duplicated in both languages, trying to make a
decision between them.

I think, after looking a so many languages over the years, and more
functional ones in the recent past, that I finally got Lisp, and
understood what made it different. I don\’t think anyone ever told me
before. I probably just didn\’t know anyone else who understood
Lisp. I certainly do now, though. Most of the Lisp I had seen (and
tried to write myself) was like ugly C. And what\’s this idea about
not doing assignment? Jeez, what are these people thinking.

When I was first introduced to prefix notation, my brain had trouble with expressions like

sh: /home/pfeilgm/bin/enscript: No such file or directory

I read that as \”plus three, four, five\”, which didn\’t really make a whole lot of sense. But, then I learned to read it as \”add three, four and five\” or \”the sum of three, four and five\” and suddenly prefix notation seemed very natural.

However, I\’ve still found places where this grates against me. The boolean logic operators, for example.

sh: /home/pfeilgm/bin/enscript: No such file or directory

can\’t really be read as anything but \”and foo, bar and baz\” … I mean, the word is right there to be read. So …