Wednesday, April 21, 2010

Caml-inspect: Version 0.2

I've pushed a new version of the Caml-library to github, and I must say, I'm really starting to like this whole open-source thing. It's quite exciting. Amongst the changes are an updated README (usage instructions), documentation using ocamldoc (make htdoc), and packaging using the -pack option of the OCaml compiler. And easier installation with make using the new install/uninstall targets.

The next step will be to host the project on http://forge.ocamlcore.org/, so it has more exposure to the intended target audience. I've already registered the project as caml-inspect. I am currently awaiting approval from the site admins.

Friday, April 16, 2010

Bugfix for S-expression dumping


I've pushed a new version of the code. The code to dump s-expressions did not handle references correctly, but it should now.

Maybe next time, I should prove the correctness using Coq. But then I would not be writing new code, would I?

Ah, what a dilemma between theoretical exactness and practical application. I wonder if Haskell will bridge that gap elegantly. We never really had the time to get aquainted.

Thursday, April 15, 2010

I'm on Github now


It is done. I now have an account on Github and my first open source repository has just been pushed. Feel free to take it for a spin. And don't forget to tell me what you think of it.

Anyway, after downloading and unpacking the library, just follow the installation instructions in the README file. If you have findlib installed, using the library is as simple as typing

> #use "topfind";;
> #require "inspect";;

into your OCaml prompt. I suggest you open the Inspect module as well.

> open Inspect;;

For starters, both the Dot and the Sexpr library provide a test_data function to generate some interesting data to dump.

> Sexpr.dump (Sexpr.test_data ());;
> Dot.dump (Dot.test_data ());;

It is naturally also possible to let the dump functions inspect themselves:

> Sexpr.dump Sexpr.dump;;
> Dot.dump Dot.dump;;

If you are on a Mac, the Inspect.Dot.dump_osx function should be of interest. It writes the DOT output to a temporary file, uses Graphviz to generate the graph, and displays the results using the open command.

> Dot.dump_osx Dot.dump_osx;;

It goes without saying that you should have Graphviz installed for this last part to work.

Have fun!

Wednesday, April 14, 2010

Object-dump of a BSP-tree



The main motive behind the Inspect library was to be able to see the actual datastructure of a previous project of mine.

Seems like some things could be optimized...

Tuesday, April 13, 2010

A little something...


Here is a little preview of what I am working on at the moment. It is a little library for the beautiful (1) OCaml programming language that allows one to inspect any OCaml value in the REPL by dumping pretty printed S-expressions or producing output for Graphviz.

Something along the lines of

val dump : ?context:dump_context -> 'a -> unit
val dot : ?context:dot_context -> 'a -> unit

There will be more.

Oh, and I am trying out the OCamlMakefile as a substitute for OMake, and I must say I really like it so far. Although OMake has served me well in the past.

-

1: Too be fair, she has some warts, especially with regard to her looks (the quirky syntax). Plus, it can be hard to understand the things she throws at you when you do something wrong (the error messages).
After spending some quality time with OCaml, however, I never ever want to go back to the beast that is C++. That was such an abusive relationship. C on the other hand...

Alright, here goes nothing.

Yeah, well...
The time has come for me to expose myself and my interests to the whole world.
Just sitting in the proverbial basement and hacking the nights away, absorbing knowledge (well, mostly just surfing the internet ;-) and never sharing any output with the world does not cut it for me anymore, I guess.

I will still enjoy spending the occasional sleepless night slouched in front of my warmly glowing monitor, with the cursor eagerly blinking while Emacs patiently waits for my input. However, as of this day, I will also try to share some of my ideas and thoughts with the rest of the world (or at least the miniscule part of it that might be interested in what I have to say).

That's all for now. More to follow.