January 23, 2010

clojure + latex

Here is small addition for great 'listings' package, that allows to put Clojure code into LaTeX documents

January 21, 2010

new domain for home page

I moved my home page to separate domain - http://alexott.net/, but all links to old pages should work as before, with redirection to new address...

January 18, 2010

Coders at Work

Just finished reading of Coders at Work. Although this is read-once book, but it worth to read it - you can get some view of how well-known software developers are working and thinking.
All these peoples have different stories, but some of them have pretty much common.  For example, many of them use debug print with careful reading of code to tackle bugs, and don't use interactive debuggers. Many of them use Emacs as editor, including Google's Chief Java architect.
So, if you'll get a chance to read this book, it worth to spend some time reading it....

January 6, 2010

boost.spirit2 vs. atoi

I did very primitive test of performance for new version of boost.spirit. I read somewhere, that boost.spirit v.2 over-performs atoi on parsing of integers, and I decided to check this with help of program, shown below. With compilation in release mode, and for 10000000 iterations, I got following results:
atoi   = (10000000 rep): 00:00:00.404165
spirit = (10000000 rep): 00:00:00.043559
Update: I slightly modified parser so it will handle whitespace before numbers (as atoi does), and still have better results for boost.spirit:
atol   = (10000000 rep): 00:00:00.411694
spirit = (10000000 rep): 00:00:00.112000
Next, I'll do tests for complex parsers.

#include <boost/spirit/include/qi.hpp>
#include <iostream>
#include <boost/date_time/local_time/local_time.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>

using namespace boost::spirit;

typedef void (*void_func)(int);
void measure_time(const char *str, void_func func, int number_of_repeat) {
    using namespace boost::posix_time;
    ptime tStart = microsec_clock::local_time();
    (*func)(number_of_repeat);
    ptime tEnd = microsec_clock::local_time();
    time_duration tVal = tEnd - tStart;
    std::cout << str << " (" << number_of_repeat << " rep): " << to_simple_string(tVal)  << std::endl;
}

const char* nstr="123456";
const char* const nstr2="123456";

void test_spirit(int number_of_repeat) {
    int val=0;
    for(int i=0; i < number_of_repeat; i++) {
        qi::parse(nstr,nstr+6,int_,val);
        if (val != 123456)
            std::cout << "Spirit Errror! val=" << val << std::endl;
    }
}

void test_atol(int number_of_repeat) {
    long val=0;
    for(int i=0; i < number_of_repeat; i++) {
        val=atoi(nstr2);
        if (val != 123456)
            std::cout << "Atoi Errror! val=" << val << std::endl;
    }
}

int main(int /*argc*/, char **/*argv*/) {
    measure_time("atol   =", test_atol, 10000000);
    measure_time("spirit =", test_spirit, 10000000);
    return 0;
}

December 31, 2009

Clojure 1.1 is released!

New version of Clojure is released! In new version, there are many changes....
and Happy New Year to all!

December 25, 2009

As Christmas present I got beautiful book Design Concepts in Programming Languages. This is very interesting book about many interesting topics in programming....

October 28, 2009

clojure class compilation...

just not to forget: when trying to compile clojure source, be sure, that `pwd`/classes is in your CLASSPATH!

October 16, 2009

Several days ago I started to play with Clojure for one of my pet projects. After several days of use, I can say, that it's pretty good choice, as I have access to library-rich JVM from one side, and I can develop programs interactively, using Emacs + Slime (about customization of Slime for Clojure I'll write some time later - it not finished yet)

September 28, 2009

Second Issue of Russian FP Journal

The second issue of "Practice of Functional Programming" Journal (in Russian) was released today. This issue contain several articles about use of functional languages in "industrial" software development, including my article about development of "Dozor-Jet" - set of software products for data leak prevention, and compliance...
You can also discuss this issue at LiveJournal....

August 25, 2009

A Friend of mine (well known in Russian Lisp/Emacs community) had created a blog in English, mostly for articles about Common Lisp & Emacs, so if you interested, you can subscribe to it...