Better sort
I modified the sort operator to work on any collection. It also required a few small changes in the optimiser (when pushing the operator down the syntax tree, the operators in between must be modified to handle lists instead of bags or sets), but I think this concludes my work on this for now. I also tried looking into the profiling of my program. Unfortunately, it seems that the database module is not the only one to use threads (that prevent O'Caml profiling from working) but the lexing module does so too. This is really annoying: I probably will have to write SLinks programs directly in internal representation, and drop the parser entirely for those tests.
I also spent some time trying to understand the "Obj" module for O'Caml, which is a (somehow hacky) method to access the internal representation of data at runtime. I was hoping this would help me to debug my code (not that I need that, of course) by being able to inspect what is going on at runtime. Unfortunately, too much information is discarded at runtime for it to be practical. I got some nice graphs of the run-time structure of my data though.