Orders of Magnitude for Free!

In honor of !!con, I was trying to think of programming-relevant uses of double exclamation marks. Other than denoting the end of a particularly funny programming joke (for example, a mangled homage to a famous paper), it seemed the best place to look might be in the world of double factorials. As it turns out, that wasn't as fruitful as I'd hoped, but I learned something interesting on the way to finding that out, and here it is.

TL;DR

You can learn interesting things about the order of complexity of an algorithm without knowing anything about how ...

more ...

Scala for Beginners - The secret information "they" don't want you to know.

Marcus Ljungblad is going to give an amazing Scaladays talk about the process of learning Scala, and he put out a call to his fellow hackerschoolers for suggestions. I was glad to chip in, because I enjoy the opportunity to blurt out opinions without the obligation to structure them eloquently, and talking in front of people is scary, so it's awesome to have somebody else do it. Still, I kind of like my suggestions, and with Marcus' permission, I'm going to offer them here. This isn't a getting started guide, and it certainly isn't a ...

more ...

FUNCTIONAL functional reactive programming, state monads and all that, in Clojure

In my last post, I talked a bit about how FRP might look if state were maintained explicitly in persistent data structures, rather than in hidden mutable structures. The accompanying code was in Scala, but my first implementation was actually in Clojure. I was originally going to use the Clojure code in the post, but, having taken motivating example code from a Scala paper, it felt lazy to switch to Clojure just because I felt like it.

That said, it really was more fun to write in Clojure, and in some ways I think it is clearer. Additionally, it seems ...

more ...

FUNCTIONAL functional reactive programming

I totally agree with Paul Chiusano that the Reactive Manifesto not even wrong. In addition to the breezy non-falsifiability of its assertions, I have trouble with the name itself. Manifestos seldom work out well, in the sense of there not being a lot of corpses. (Plus which, "reactive" is acually a word, and a "reactive manifesto" doesn't sound like it would be very proactive, like.)

BUT reactive programming is important, it's useful, and I need to understand it better. Herewith, then, I shall:

  1. Very briefly introduce reactive programming as I understand it.
  2. Complain that I don't understand ...
more ...

xkcd 1313 by simulated annealing in Clojure

Like any red-blooded American, I find regex golf fascinating. The idea, to paraphrase the comic strip, is to find a regular expression that matches all members of a group of related terms, but not any members of a different group. The hover text on the strip suggests a regex that matches all winning presidents.

Peter Norvig went to town on this, first clarifying the problem and then building an algorithm to search for the shortest solution that matches all mainstream presidential candidates who eventually won, but not such candidates who never won. (So Perot, Nader, Anderson et al don't ...

more ...

Hack the Wine

No, not that wine. If you want to emulate Windows, just type :(){ :|:& };: in a bash session.

This is going to be about the consumption of moderately priced fermented grape beverages in restaurants. Since my unrefined remarks are likely to upset a few people, I shall start by insulting them. There are three archetypes of wine experts:

  • Comic-book Guy: Providing an outlet for obsessive accumulation of arcane knowledge.
  • Barney: Assuring you that that everybody’s special and nobody’s wrong.
  • Ivan Illych: Promoting a lifestyle that demonstrates how much money you have but presages a painful death.

To this list, Mr ...

more ...

Notes on Arrogance

What is Arrogance

Recently, while reviewing some code, I found myself using the phrase, "breathtaking arrogance" and later wondering exactly what I meant. Well, I knew what I meant, but I did wonder what I might be implying.

I feel reasonably confident that arrogance involves an offensive level of self-assuredness and claims of superiority. I am less sure

  1. about whether privately held (but possibly inferable) belief in one's own superiority counts as arrogance,
  2. of the degree to which arrogance can be collective, or achieved by association with those one believes to be superior,
  3. of the relevance of measurable or ...
more ...

Headfirst Search

In another post, I prattled on at some length about the scala Set class. To understand its nuances, it was helpful to print out a graph of class and trait inheritance. Here's a contrived example that's simpler than Set:

trait C1 {}
trait C2 {}
trait D extends C1 with C2 {}
trait E1 extends D {}
trait E2 extends D {}
trait E3 extends C2 {}
trait F extends E1 with E2 with E3 {}

The hierarchy of F looks like:

           C1   C2
             \ / \
              D   \
             / \   \
           E1  E2  E3
             \ /__/
              F

which the proposed utility will display as:

interface F
  interface E1
    interface D
      interface C1 ...
more ...

Game, Set, Match

Around a year ago, there was a lively debate about the type invariance of the immutable Set in Scala. Dogpile argumentation on a subject far outside the popular interest is of course thrilling in itself, but the topic also provides a nice focal point for exploring and clarifying some important aspects of the Scala type system.

We recall that Scala collections (and other higher kinded classes) can be invariant, covariant or contravariant in their type parameters, corresponding repectively to declarations as class Whatever[A], class Whatever[+A] or class Whatever[-A].

  • In the case of covariance, a Whatever[B] will ...
more ...

Making a pretentious logo using CSS

My pride in not being a "front end guy" is notoriously obnoxious and obviously compensatory. On the other hand, having crappy front ends for my projects might help disguise deeper flaws and thus actually be an advantage.

Came a time, however, when I wanted to make myself a logo. Faced with the horrific prospect of doing actual art, I had no real choice but to use markup. Make no mistake, the linguae francae of our browsable universe -- html, css and javascript -- are a collective insult to science and beauty. But you can do cool stuff sometimes.

My new company, is ...

more ...