Printing the class-path in Clojure

Let’s compare how we print the class-path in Clojure and how we do it on Java.

In Clojure:

(println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))

In Java:

import java.net.URL;
import java.net.URLClassLoader;

public class PrintClasspath {
    public static void main(String[] args) {
        //Get the System Classloader
        ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader();

        //Get the URLs
        URL[] urls = ((URLClassLoader)sysClassLoader).getURLs();

        for(int i=0; i< urls.length; i++)
        {
            System.out.println(urls[i].getFile());
        }
    }
}

To be fair, the output is not the same, but the effect is.

Advertisements

The need for a common language

This is just one small example of why we need a international common language.

In 1975, the World Health Organization refused:

  • U$S 148,200 for a better public health service in Bangladesh
  • U$S 83,000 to fight leprosy in Burma
  • U$S 26,000 for basic hygiene in Dominican Republic
  • U$S 0.50 per patient to cure trachoma, which has millions of victims and can cause blindness
  • and many other requests

Meanwhile, it accepted Chinese and Arabic as working languages increasing the expenses in in translations by U$S 5,000,000, every year. Continue reading “The need for a common language”

My first Esperanto experience

I decided, some years ago, to start learning Esperanto.

I went to Lernu and spent three days learning. On the third day I’ve decided to open the instant messaging system on that web site to see what was going on. I ended up chatting with someone from Russia, in Esperanto.

We talked about the usual things you talk when you only learned the language for three days. How are you? where are you from? where do you live? do you have brothers or sisters? blah blah. I was amazed I could communicate so soon. Eventually I’ve got tired and I said something like “OK, that was fun, let’s continue in English please.”

– “Mi ne parolas la anglan.” was the reply. “I don’t speak English.”

What about la hispana (Spanish)?

– “Ne”

I was talking with someone with whom I didn’t have any other common language than Esperanto. Three days before that we couldn’t have even say hi to each other.

The first time I heard about Esperanto

The first time I heard about Esperanto, I attacked it. Because that was what everybody around me did and I’ve learned from them.

The second time, it annoyed me and I attacked again.

The third time, I was indifferent.

The fourth time, I was curious.

The fifth time, I started to learn it.

That’s why I keep repeating to anybody who’d listen: Esperanto, Esperanto, Esperanto, Esperanto, Esperanto. And I encourage others to do the same.

Hacking on the Clojure application

Being able to write, build and run a Clojure application, like I explained in a previous article, is not enough. You also want to hack on it, to iterative code on it, after all, you are using a Lisp.

What I mean by iterative coding is something not very few know or do, but it’s extremely common in Lisp. You have you REPL running all the time (that is, generally, the interpreter). You load the code into the REPL, run it, modify some part of the code and re-load it. You may not reload the whole file but only a function on it, and you may have background process running on the REPL, like a web server. It is very powerful. Continue reading “Hacking on the Clojure application”

Martial arts, Zürich style

Kendo
Kendo

I like martial arts and I’ve practiced a couple during my life, and tried a few as well. Recently I became interested in them once again when a mail informed me of the existence of a dōjō near my house in Zürich.

And indeed Budokan is a dōjō; only Japanese martial arts are practiced there. One that always sparked my interest was Kendo, but so far I’ve never even managed to view a class. It was about time.
Continue reading “Martial arts, Zürich style”