Archive for the ‘Code’ Category

Approaching AI

Sunday, November 13th, 2005

You know, I had a silly little thought about AI the other day … People talk about software that can write music, hold a conversation (the Turing Test), or some other creative task being the \”real\” test for AI. But really, a person wrote the program that wrote the music, so you really want to say AI has succeeded when it writes a program that can write programs that make music. So, at this level, we now have programming being the \”real\” test. Of course, we know it\’s creative, but it\’s not really seen that way. But, even if we write a program that writes music-writing programs, we\’re still acting at one level above that program. So, we need to write a program that can write programs that will generate arbitrary levels of other programs and eventually spit out a music-writing program. Of course, then we\’re writing programs that do this arbitrary nesting, so we have to write programs that do arbitrary nesting to show that the AI is real. After this, it gets a bit recursive …

(more…)

Typing Done Right

Saturday, September 17th, 2005

I\’m a big fan of all the sort of agile/dynamic sort of stuff. C2:TestDrivenDevelopment, C2:IterativeDevelopment, etc. But one thing I\’ve always had trouble with is accepting C2:DynamicTyping as the Right Thing. I mean, yeah, C2:ManifestTyping sucks, but C2:TypeInference is there to pick up the slack, as ML and Haskell show. With type inference, you get the clear code of dynamic typing, with the safety and performance of static typing. Which, I thought, was everything.

Yeah, I had heard the whining of those die-hard dynamicists who procliamed that there are correct programs that can not be statically typed. I didn\’t disagree, but I felt that for all practical purposes it was irrelevant. However, I\’m now working on a project where static typing gets in my way every day. It\’s unbearable.

I have a solution, which I think balances all the important bits. Yes, it\’s not perfectly \”safe\” like you static guys like, but it gives you the flexibility when you need it.

  1. type inference is key;
  2. there should be something like C2:CommonLisp\’s DECLAIM that allows you to say whether un-inferenceable bindings are errors, warnings, or ignored (and should default to errors, making the static guys happy);
  3. you can DECLARE individual bindings as dynamic, regardless of whether they\’re treated as errors.

Anyone who just wants dynamic fun DECLAIMs that un-inferenceable bindings are ignored, while others can make them warnings or errors and deal with the exceptions on a case-by-case basis. Type inference is always used whereever it is possible.

Daft Engineer

Tuesday, September 13th, 2005

My friend and co-worker, Mike, and I love de Daft Punk. Lourve it, I tells ya. So, after too many hours of watching the best Web site evar, we realized that they were instructing us in How to Code. Let me lay it down for you:

Work it harder
spend your time making it work, and work according to spec. Work hard at this.
Make it better
refactor, refactor, refactor. Keep the code clean, improve your algorithms, add unit tests.
Do it faster
ok, now you can optimize, but make sure you\’ve got a profiler there to tell you what\’s slow in the first place.
Makes us stronger
this leads to better software, more robust, and that keeps your company strong.
More than ever hour after (h)our work is never over
wash, rinse, repeat. Iteration, my friends, iteration.

These five simple steps will have your boss offering you the mad bling-bling and keep you rockin\’ like Dokken.

Shut up!

Monday, August 1st, 2005

So, I\’m turning off comments. Considering I get a worse than 1:5000 signal-to-noise ratio, it just wasn\’t worth my time moderating. I\’m also in the process of moving things to new software (cl-blog, written by Brian Mastenbrook), so I want to keep down the amount of content that I need to port.

I figure I should be using the Lisp tools if I want to actually bother hacking on them. One of the first things I\’ll need to add is Markdown …

Stanford: Home of McCarthyism (the good kind)

Thursday, June 16th, 2005

So, on Saturday I leave for the International Lisp Conference. I\’m pretty friggin\’ excited about it. There are a ton of cool talks scheduled, but the one I\’m most excited about is the one least-related to work.

I\’m trying to read as many lisp books as possible before I leave — make sure my brain is properly stretched before diving into such a rigorous program. I\’m going to attempt to blog about all the sessions I go to, but considering there are ten sessions each day, with a scant 10 minutes between each, it might be rough. I\’ll trackback to this entry for each of the ones I manage to talk about.

Amazon for the REST of Us^WYou

Sunday, May 22nd, 2005

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.

For those less into Lisp, there\’s also a Ruby API.

MetaBlogging and HyperSpec

Tuesday, April 5th, 2005

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.

(more…)

Blikied!

Monday, April 4th, 2005

Wow, that was easy. I\’ve now got C2:WikiNames working in my blog (or should I say, bliki). Took maybe 20 minutes to write the whole thing, and that includes the time spent forgetting that backspace acts like delete on my host.

Yeah, I know I don\’t have it pointing at an actual wiki yet. I\’ll get to it. At least I can C2:InterWiki really easily now. It marks them up like:

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

Oh yeah, I also installed a syntax highlighting plugin while I was looking for a C2:WikiNames plugin. I\’m being super-productive tonight.

(more…)

Patterns of Deconstruction

Wednesday, March 16th, 2005

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:

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

(more…)

My Favorite Speech Impediment

Wednesday, February 9th, 2005

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.

(more…)

A Geek, By Any Other Name …

Thursday, December 9th, 2004

What is it with people using \”rock star\” positively these days? In my mind it\’s someone who\’s arrogant, doesn\’t take suggestions, doesn\’t help others, and generally doesn\’t have the ability to back it up. On occasion, it means someone who\’s arrogant, but deservedly so.

In the recent past, though, I\’ve heard a number of people use it positively. (more…)

Accepting Prefix Notation

Friday, October 15th, 2004

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 …

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

Problem solved.

Aspects of Aspects

Tuesday, September 7th, 2004

My friend Jonnay posted about implementing dynamic aspects in Scheme. I told him I\’d follow-up with my own views, but I\’ve been slack. Here they (finally) are.

If you\’re unfamiliar with aspects or Aspect-Oriented programming, you might want to take a look at the seminal C2 Wiki or the original Java-based AspectJ project.

(more…)

Geeks on Film ? Geeks on Film

Wednesday, August 25th, 2004

(apologies to Duran Duran)

Marketing is a big part of getting anything seen. This holds true for computer languages as well. Java, for example, would not have seen today\’s success were it not for the power of Sun\’s marketing machine.

So what happens when the less marketing-savvy language designers decide to try their hand at evangelizing?

(more…)

Code Grab

Wednesday, August 25th, 2004

Cameron set up the Screen Grab Confab over at his site. It\’s to give a keyhole-style glimpse of what people are working on at the moment. I\’m no designer, but here\’s my contribution to the 320 ? 320 collection:

(more…)

I Don\’t Know Enough Math

Friday, August 13th, 2004

A lot of my friends are of a more artistic bent, so when I mention something like Google\’s \”{ first 10-digit prime found in consecutive digits of e }.com\” hiring campaign, I usually get a response like \”What\’s e?\” It\’s the kind of thing that makes me think I\’m pretty good at this math stuff. Then something comes along that proves me wrong.

(more…)

Agile is Old

Friday, August 13th, 2004

Agile methodologies are considered to be the new kid in the software process game. As the young turk, they challenge the ideas of big process and are often accused of being too new to have been really put to the test. They\’re a lot older than you might think.

(more…)