Shuffling the stack: first faltering steps on Factor

In my neverending quest of avoiding actually getting any of my projects ready, I started playing with Factor. In four years, Slava Pestov and the other folks hacking on Factor have created an extremely impressive language, beating many other dynamic languages like Python and Ruby in speed and providing an environment that doesn't make the Factor 2.0 goal "Best interactive development environment of any programming language" sound like an impossible idea.

But it does have a steep learning curve. The concepts of the language aren't difficult — in many ways it resembles other dynamic languages — but it feels like I'm clumsily trying to perform mental gymnastics instead of actually being productive. See, it's a Forth-style stack shuffling concatenative programming language. There are named variables (dynamically scoped, which feels weird, but that does have its uses when used sparingly) and these days there are even lexically scoped named locals, but depending on those instead of getting used to stack manipulation would be cheating, no? So now I'm slowly dupping, overing, tucking and swapping my way through simple algorithms, trying to switch my head into the right gear.

Article page

This is how all software should be

 $sudo -u couchdb /opt/couchdb/bin/couchdb 
 couch 0.7.0a572 (LogLevel=info)
 CouchDB is starting.
 CouchDB has started. Time to relax.

It's a bit like having a dictionary with the words "Don't panic" printed on the cover in big, friendly letters.

Article page

Resin: Javascript in JSPs?

Am I missing something here? JSP Templates vs.

/test.jsp:1: 'javascript' is not supported as a JSP scripting language.

1:  <%@ page language="javascript" %>

That's what Resin 3.1.2 tells me.

Update: Right, now I noticed this in Resin 3.0.0 release notes:

Since the JavaScript for JSP was used by too few users, it no longer makes sense to continue support.

Arf.

Apparently Tomcat, Jetty and Glassfish all support only Java in JSPs, not any javax.script implementations. Now I'm trying to figure out how to use EJS from scripting.dev.java.net. Any other Javascript templating options for servlets? I know Helma, but I'm interested in the front-end code (templates, value objects, possibly controllers) only.

Article page

Cirque du Soleil's Delirium: meh

We went to see Cirque du Soleil's show Delirium, now in Helsinki on their tour of Europe, yesterday. It was the first time I've seen any of their shows live. It wasn't exactly bad, but not what I was hoping for. The most important part seemed to be the music and the video stuff, and the acrobatics were a bit of an extra. Trouble is, the acrobatics were what we went there to see.

The music was an A-Z of genres with no carrying theme, going from rock with guitar heroics to Africa flavoured world fusion to soul to pop to salsa to tango. And few of the songs were all that great, either, basically sounding like filler tracks on a pretty ok album. A different album in each case, of course.

The video show was amazing, mostly computer generated and in all cases heavily processed, with two big screens on each side of the stage, one behind it and a translucent one part of the time in front of it.

And occasionally somewhere there were a few acrobats. They were mostly extremely impressive, too. At least when you could see and concentrate on them. Too often, though, even if they were there, there was the huge A/V show going on all around them, drowning them with its volume, both in terms of sound and screen area. And as if that wasn't enough, sometimes they had the translucent screen in front of the stage showing water or something, forcing you to squint to see the people who you thought were supposed to be the most important part of the whole experience.

According to the official web site, "For the first time Cirque du Soleil created a show where melodies, musicians and singers are the driving force". I guess I'll just have to keep that it mind when deciding which show to go see next time.

Article page

Glade-3 toolbars

This note is here so I can grep or Google for it the next time I spend ten minutes clicking around the Glade-3 window, trying to remember what the trick was: Glade-3 has put the menu and toolbar editors behind an edit button below the the properties notebook.

Article page

Python-style enumerate for Nemerle

So instead of just whining about Nemerle, here's a something potentially useful. I found I missed Python's built-in enumerate function. It wasn't too hard to implement in Nemerle:

public class Enumerator['a] : IEnumerable[(int * 'a)] {
    private e: IEnumerable['a];

    public this(e: IEnumerable['a]) {
        this.e = e;
    }

    public GetEnumerator(): IEnumerator[(int * 'a)] {
        mutable i = 0;
        foreach (elem in this.e) {
            yield (i, elem);
            i++;
        }
    }
}

Usage:

foreach ((index, item) in Enumerator(list)) {
    System.Console.WriteLine($"index for $item: $index");
}

The naming might not be optimal, with potential confusion with the standard libraries, but I don't care at the moment. Use and enjoy.

Article page