elehack.net

Posts tagged "programming"

Tuning the OCaml memory allocator for large data processing jobs

TL;DR: setting OCAMLRUNPARAM=s=4m,i=32m,o=150 can make your OCaml programs run faster. Read on for details and how to see if the garbage collector is thrashing and thereby slowing down your program.

In my research work with GroupLens, I do a most of my coding for data processing, algorithm implementation, etc. in OCaml. Sometimes I have to suffer a bit for this when some nice library doesn’t have OCaml bindings, but in general it works out fairly well. And every time I go to do some refactoring, I am reminded why I’m not coding in Python.

Read more...

My first OCaml syntax extension

Preface: In this post, I describe my adventures figuring out how to write a syntax extension for the OCaml programming language and attempt to provide something of a tutorial on writing a basic extension. I assume that you’re somewhat familiar with basic parsing technology and context-free grammars — if not, a good tutorial on parser construction with a tool like Yacc would be worth a read first.

One of the oft-touted benefits of OCaml is Camlp4, a pre-processor that facilitates extending the OCaml syntax to provide natural support for various constructions. This has been used for a variety of purposes, such as database type-checking, monad sugaring, and logging. In the hands of a capable author, a variety of wonders can be introduced to the OCaml language.

Read more...

DVCS selection woes

I’ve been a convert to distributed version control, and in particular a user of Mercurial, for a few years now. I love Mercurial — its user interface is simple, the core concepts make sense, and it generally does an intelligent job of managing my programs (or config files, or homework assignments, or whatever).

I’ve tried to learn Git a few times, and even started converting to it some time last year, but go back to Mercurial for its user-facing simplicity. Internally, Git is simpler, but mapping use cases on to that simplicity is entirely exposed to the user. Mercurial’s UI is much more task-driven, such that there’s really one obvious way to do most useful things. I usually am able to keep my Mercurial repositories in somewhat sane states; Git’s failure mode seems to be leaving your branch refs in an incomprehensible state.

Read more...

Perl 6 operator table

This is kinda cool and kinda scary. Why do we want Perl 6, again?

Insight into the Java design process

Found this today while reading FreeBSD Planet. While I actually find Java’s enums somewhat useful, I do agree that they are a bit wonky...

Solution on simple world post

Some weeks ago, I wrote an article on my dilemma trying to determine which language to use for a calendar system. I just thought I’d make a public update to not leave it hanging.

The solution is Emacs. I’m now using org-mode, combined with diary. I’m working on some Perl and elisp hacking (so far just the Perl) to create a calendar system that synchronizes with my Clie (using PilotManager, since it already has a conduit for BBDB). This, combined with Gnus for reading my e-mail, is working rather well, and using remember.el I can easily convert an e-mail into a task. I even switched from IMAP (nnimap backend) to the nnml backend and that seems pretty nifty (so far).

Read more...

Why can't the world be simple?

I’m presently facing a programming task to work on, and am thinking through which language to work on it in. It’s a simple calendar & address book app, so it needs to work with vCard/iCalendar and network/VFS type things (at least HTTP). It also needs a GUI; preferably GTK+.

Contenders:

Read more...

OO: the new spaghetti code?

Many moons ago, Simula was created. From it came Smalltalk, and C++, followed by Java and a host of other languages sporting this new programming paradigm: object-oriented programming. Objects are everywhere — most new/modern languages, at least in the mainstream, are based on them — and are used for everything. In Java, all the core data structures are implemented in an object-oriented fashion.

I’m not convinced that all this is a good thing. In fact, I submit that excessive use of object-oriented principles leads to a new kind of spaghetti code, rendering programs perhaps as unreadable as when implemented with unscrupulous GOTOs. OK, maybe not quite, but it can still be pretty bad.

Read more...

Eureka! A reversible debugger!

I blogged a while ago about finding OCaml, and really liking it. Well, that like has now been intensely increased.

For some time now, I have wanted a debugger that can go backwards. A company called Undo Software has one, UndoDB, that works with GDB. But they charge a decent fee for their product.

Read more...

OCaml for teaching?

I’ve been thinking lately: What would happen if we used OCaml as a language for introductory programming at the collegiate level?

To be sure, it would need some improvement to be suitable for this. For starters, a compiler with more useful error messages (although I have heard that using camlp4 improves error message quality). Also, some good interactive environment, possibly fusing the capabilities of DrScheme and Eclipse, would be most beneficial (I have heard of the existence of a project called DrOcaml; perhaps it has some merit).

Read more...

Page 1 of 2 | Next >>>