Archive for November, 2008

EmotionML

Tuesday, November 25th, 2008
<emotionml xmlns="http://www.w3.org/2008/11/emotionml">
    <emotion>
        <intensity value="0.4"/>
        <category set="everydayEmotions" name="surprise"/>
        <link uri="http://www.w3.org/2005/Incubator/emotion/" role="triggeredBy"/>
        <link uri="http://probablyprogramming.com/2008/11/25/emotionml/" role="expressedBy"/>
     </emotion>
    <emotion>
        <intensity value="0.7"/>
        <category set="everydayEmotions" name="amusement"/>
        <link uri="http://www.w3.org/2005/Incubator/emotion/" role="triggeredBy"/>
        <link uri="http://probablyprogramming.com/2008/11/25/emotionml/" role="expressedBy"/>
     </emotion>
</emotionml>

Don’t complain if it doesn’t conform, because it’s not a fixed standard yet. ;)

A prefix notation programming language

Sunday, November 16th, 2008

Prefix notation?

Have you ever dreamed of a language which uses strictly prefix (a.k.a. polish, Ɓukasiewicz) notation?

No? Well, I can’t say I’m surprised. Lisp is often called a prefix notation language, but I’ll let you in on a secret, it’s not purely prefix notation. It uses another notation you’ve probably never heard of: outfix notation.

Outfix notation?

I’d say I made outfix notation up, but I found a reference to it on abstractmath.org, so I at least have something to back this claim up with. Basically, the parentheses are a function which says, “put these items into a list.”

Of course, Lisp uses lists for everything, so you can hardly call it a prefix notation language any more.

Real prefix notation

Now, how about making a real prefix notation language? A real prefix notation language needs no parentheses because it knows how many arguments each function takes, so it can simply pull in the next two expressions following the function name.

A real prefix notation language is a piece of cake to implement, as long as every function has a fixed arity and that arity is known at compile time. Of course, then how do we represent things such as lists with varying amounts of items. How do we pass a variable number of arguments to a function?

The same way Lisp does, we use a list.

(more…)

MPD shuffle-rest

Saturday, November 8th, 2008

When I listen to music, I generally like to shuffle my playlist. Sometimes I’ll add new music to my playlist, and I want to shuffle that music into my playlist as well.

The problem is that I don’t want to listen to music that I’ve already listened to recently, but if I shuffle the playlist again, that will probably happen. I use MPD as my music player, and the client I’m using doesn’t have the functionality I want (shuffling just the songs I haven’t listened to yet).

Today I hacked together a quick solution to the issue using Python and python-mpd. You can check it out here: shuffle_range.py

(more…)