2 Posts for April 2007

Quines

Posted April 28, 2007

I was browsing reddit recently when I can across a link to a quine. Not just any ordinary quine, either – a polyglot quine. It works in three different languages: Haskell, OCaml, and Scheme.

For those who aren’t familiar with the term, a quine is a program that prints its own source code. There are a few fairly obvious caveats: it can’t read the code from the filesystem, it can’t take user input, empty programs don’t count. The term was coined by Douglas Hofstadter, who named it after logician Willard van Orman Quine. Interestingly, at the moment (and many moments before and after the current one – it’s a long book) I’m working my way through one of Hofstadter’s excellent books, Gödel, Escher, Bach, in which the word was coined and he goes into depth on the subject of quines. Unfortunately, I haven’t gotten to that point yet. When I do, I’ll be sure to mention it.

Quines are lots of fun to write, but more challenging than they may seem at first glance. I was inspired by this polyglot quine to write up a short one in Ruby. I started by trying the brute force method: creating a string containing the program.

s = "s =
Blog, Ruby
Tags

New Blog!

Posted April 27, 2007

Well, here it is: my brand, spanking new blog. In fact, it’s also my very first blog1. It’s also the first site I’ve built for myself that’s not jut for having fun with web design (although there’s still a fair bit of that). I actually have stuff to say now, hopefully stuff that the web at large (that’s you) will be interested in reading.

As for topics, I’ll be writing about whatever tickles my fancy. This will likely involve things I’m doing. The about page goes into that in some detail, but suffice it to say that I’m mostly engaged in schoolwork, of the Computer Science and Philosophy sorts (with a bit of math thrown in), working on Haml, and coding Ruby on Rails applications.

I built this site using Rails. It’s not based on any prexisting Ruby blogging software2, mostly because I thought it would be fun to write the code myself (it was). The blog is designed to be as RESTful as possible, although it falters a little with the archive system and pseudo-static pages.