Monday, 30 November 2009

Parallel programming from OCaml using HLVM

Our HLVM project has hit another milestone with new support for parallel programming using threads.

HLVM threads and mutexes are a thin wrapper over POSIX threads. The mark+sweep garbage collector now uses a stop-the-world algorithm to suspend all mutator threads while a single thread traverses the entire heap marking and then traverses all allocated values reclaiming unmarked values. This is a very simple design and an unoptimized implementation but it already makes it possible to write parallel programs passing shared mutable state between threads by reference from OCaml.

Friday, 27 November 2009

Generating and visualizing 2D mazes

The OCaml Journal just published an article about mazes:

"Maze generation is a remarkably complex and diverse subject that essentially falls into the category of network or graph theory but is most often seen in the context of games and puzzles. The characteristics that make a maze interesting for humans to try to navigate are subjective and not easily defined and, consequently, the design and implementation of an automatic maze generator is as much an art as it is a science. This article describes the design and implementation of a simple but effective maze generation algorithm including OpenGL-based visualization. The algorithm is elegantly expressed in terms of recursive functions and purely functional data structures..."

To read this article and more, subscribe to The OCaml Journal today!

Wednesday, 11 November 2009

Logic programming: n-queens and knight's tour problems

The OCaml Journal just published an article about AI:

"Logic programming is a paradigm often seen in problem solving and AI. This article introduces the subject of logic programming and explains why the OCaml language and implementation are ideally suited to these kinds of applications, using the familiar examples of solving the n-queens problem and finding a knights tour..."

To read this article and more, subscribe to The OCaml Journal today!