Here is the latest Caml Weekly News, for the week of 28 September to 05 October, 2004.
Archive: http://caml.inria.fr/archives/200409/msg00501.htmlRichard Jones asked:
I have a directed graph (actually, links between web-pages). I'd like to display it "as planar as possible". Are there any OCaml tools or libraries which I can use? The nearest I've found is ocamlgraph which looks nice but doesn't seem to deal with the display side of things.Keith Wansbrough answered:
Almost certainly Graphviz is your friend; specifically, the "dot" program. http://www.research.att.com/sw/tools/graphviz/ It's very easy to write your own binding to this (i.e., write out a simple text file in .dot format), although I'm sure someone has written one themselves if you prefer. Another option is daVinci, but it went commercial a while ago - I'm not sure what the license terms are. It was certainly open and free once upon a time. http://www.b-novative.com/products/daVinci/daVinci.htmlJean-Christophe Filliatre answered:
Indeed, ocamlgraph does not deal with the display of graphs, which is notoriously a difficult problem (and we are not graphs specialists, so we won't enter such a trap). However, ocamlgraph has an output for the ASCII .dot format, to be used for instance with the Graphviz set of tools: http://www.research.att.com/sw/tools/graphviz/ (there is a Debian package called graphviz for instance) Among these tools there is one displaying graphs (called dot, with outputs in various formats including PostScript), which makes efforts to display planar graphs (but sometimes it fails to draw a planar graph as planar). The dot input syntax is very simple. On the Graphviz web site, you'll also find a lot of material regarding the problem of graph layout.Nicolas Cannasse answered:
You might have a look at Tulip : http://tulip-software.org/ Last time I got demonstration of it, it was great ! (checkout the screenshots ^^)Markus Mottl answered:
As others have already mentioned, Graphviz (the "dot"-utility) should provide the layout functionality you need for your graphs. If you need an example of how this can be used from OCaml, just take a look at the POMAP-library. It uses "dot" to display partially ordered maps: http://www.oefai.at/~markus/home/ocaml_sources.html#POMAPDiego Olivier Fernandez Pons answered:
Graph drawing is an open and active research topic which makes a heavy usage of state-of-the-art optimization tools and algorithms. Displaying a graph "as planar as possible" is (of course) an NP-hard problem and even a very hard one because constraints are not totally explicit (most of the time you would like an interactive tool that allows you to add and remove constraints while looking for a satisfactory answer). Try AGD (it is built over LEDA) http://www.ads.tuwien.ac.at/AGD/
Archive: http://caml.inria.fr/archives/200409/msg00518.htmlRadu Grigore asked:
For this message I'll classify functions on "levels" based on how many nested parenthesis are needed to represent their type. Functions of level 0 (e.g. int -> int, char -> int -> int, ...) are the most used in programming. In widespread languages like C#, Java and C++ they are almost the only kind of functions used. Functions of level 1 (e.g. ('a -> 'b) -> ('b -> 'c) -> ('a -> 'c)) are used a lot when programming in a functional language. They are also the ones that appear in examples and tutorials written for imperative programmers. This category includes fold, iter, map, composition. However a language like OCaml allows N to go up as much as you want. My question is: are there functions of level >= 2 used in practice (e.g. (('a -> 'b -> 'a) -> 'a -> 'b list -> 'a) -> 'c)? If so, are there any typical ones that appear in many applications (maybe not as widespread like map & company but at least of comparable usefulness)? One example of a level 2 function (stolen from a recent post by Jon Harrop) is this: let sum fold = fold (+);;Jacques Carette answered:
The best answer is from Chris Okasaki in Even Higher-Order Functions for Parsing or Why Would Anyone Ever Want To Use a Sixth-Order Function? by Chris Okasaki. Journal of Functional Programming, 8(2):195-199, March 1998. Abstract: We illustrate the use of third-, fourth-, fifth-, and even sixth-order functions with examples taken from a combinator parsing library. Available at http://www.eecs.usma.edu/Personnel/okasaki/jfp98.psJean-Baptiste Rouquier answered:
In my soon-to-be-released library to read and write configuration files, I have one example of this. Basically, the function reading a file (actually a method) has on optional argument that allows the user to override the default behaviour in case there is an error. The argument is itself a function that get all the available information as arguments, including a value of type (out_channel -> unit) that pretty print (with module Format) a part of the read AST to the given output channel. So I have method read : ... -> ... -> ?on_type_error : (... -> ... -> (out_channel -> unit) -> ... -> unit) -> string -> unit Out of curiosity, may I ask why you're looking for such functions ?Jon Harrop answered and Marcin Kowalczyk added:
> I've just had a look through some real programs that I've written and the > answer is definitely yes. I use them quite a lot. For >2 they are mainly 3, > sometimes 4 and I haven't seen any >4. http://citeseer.ist.psu.edu/okasaki99functional.html
Archive: http://caml.inria.fr/archives/200409/msg00524.htmlBob Solovay asked and John Harrison answered:
> There used to be a command in Common Lisp "dump" which would store > an executable image to a file that could then be restarted. My > question is: is there something like this in OCaml. As Carl Witty pointed out to me recently, there are quite a few checkpointing programs that can dump an arbitrary process so that it can be restarted later in the same state. I've recently been using "ckpt" to save an OCaml toplevel session with HOL Light preloaded, and it works very well. Maybe other OCaml users would find the same thing useful. See: http://www.cs.wisc.edu/~zandy/ckpt/ The only drawback is that this program is Linux-specific. There's a long list of alternatives at http://www.checkpointing.org, but I haven't found a suitable one for Windows. If anybody knows of one (even if it only works under Cygwin) I'd be very interested.
Archive: http://caml.inria.fr/archives/200410/msg00001.htmlOwen Gunden announced:
GODIVA, the GODI Verpacken Assistant, is a tool for making GODI packages. GODI is the holy grail solution to O'Caml's package management problems, but the interface for creating packages, being based on NetBSD pkgsrc, is frequently overly complex. GODIVA provides a solution by accepting a comparatively simple package specification and transforming it into a full and proper GODI package. Between version 0.9.0 and 0.9.4, several bugs have been fixed and significant interface changes have been made. Even better, there's a man page! For a detailed list of changes, consult the changelog. To get GODIVA: $ godi_console update $ godi_console wish -build apps-godiva $ godi_console perform -wishes GODIVA webpage: http://projects.phauna.org/GODIVA/ Enjoy! Owen Gunden Will Lovas GODIVA hackers 1: http://projects.phauna.org/GODIVA/docs/changelog.txt
Archive: http://caml.inria.fr/archives/200410/msg00020.htmlPierre Weis announced:
I'm glad to announce the availability of the 2.2 version of the CamlImages library, by Jun Furuse, François Pessaux, and Pierre Weis. CamlImages is an image processing library, which provides to the objective Caml programmer a lot of image processing functionality. The version 2.2 is a stable development release: - complete code review and rewriting of files (including auxilliaries such as Makefiles and configuration files). - better integration with the rest of the Objective Caml system by renaming of the main module, originally named "Image", into the new module name "Images". This solves a long standing problem of name clashes with other module names provided by other libraries. However, this is not backward compatible and you will have to modify your old programs according to the new naming scheme: you must change references to Image.x into references to Images.x (and similarly from oImage.x to oImages.x). As usual, the Caml compiler will help a lot to point out obsolete name occurrences. - the whole set of compiled files are now installed in the library installation directory (generally /usr/local/lib/ocaml/camlimages). - a new export for the Ps module: get_bounding_box : string -> bounding_box returns he bounding box option of a postscript file image. CamlImages provides to the objective Caml programmer: ** basic functions for image processing and loading/saving various image file formats (hence providing a translation facility from format to format), ** an interface with the Caml graphics library allows to display images in the Graphics module screen and to mix them with Caml drawings, ** a freetype interface, integrated into the library: you can draw texts into images using any truetype fonts, ** a set of example programs, including gif animation, slide show, and a postscript converter to print images. Sources and documentation are available from: http://pauillac.inria.fr/camlimages/eng.htm ftp://ftp.inria.fr/INRIA/Projects/cristal/caml-light/bazar-ocaml/camlimages-2.2.tgz Contributions and comments are welcome.
Archive: http://caml.inria.fr/archives/200410/msg00023.htmlPierre Weis announced:
Active-DVI Active-DVI is a presenter and previewer for texts or slides written in LaTeX, hence the presentation tool of choice for the discriminating hacker. Version 1.6.0 is now available. As the release number shows, this is a major improvement w.r.t version 1.4.0 of Active-DVI. This new version has been developed by Jun Furuse, Didier Rémy and Pierre Weis with also contributions by Roberto Di Cosmo. In addition to the regular features of the Active-DVI previewer: * Encapsulated Postscript File inclusion (using the graphics LaTeX package) * Some effects for presentation (pause, delay, text color change) * Embedded applications this release introduces a lot of new features * Improved API for embedded applications. * Support for X colors via an additional xwindows-colors.sty LaTeX package. * Thumbnails to see the entire presentation at a glance (press T to build the thumbnails, then t to toggle from thumbnails to your presentation). * Hyper references can now be made invisible. * Enhanced background possibilities. * A laser pointer. * Support for ``scripting'' from within the LaTeX source file via key bindings events generation. * Programmable save-slide feature. * An additional advi-slides.sty package facilitates easy presentations and is specially devoted to the impatient and/or the beginner. (Comments on this new package are warmly welcome.) * Additional examples, including simple ones for the slitex LaTeX package. * An improved manual. Play advi on the demonstration presentation demo.dvi that is in the test directory of the distribution. Look at source code of the various talks in the directory ``examples''. The source code and more information are available at http://pauillac.inria.fr/activedvi/ Once again, contributions and comments are warmly welcome. Mailing list email@example.com Bug reports to firstname.lastname@example.org
Archive: http://caml.inria.fr/archives/200410/msg00027.htmlDidier Remy announced:
It is my pleasure to announce a new release of WhizzyTeX. WhizzyTeX is an Emacs minor mode for incrementally viewing LaTeX documents that you are editing. It works under Unix with gv and xdvi viewers, but the Active-DVI viewer (see http://pauillac.inria.fr/activedvi/) will provide much better visual effects and will offer more functionalities. Version 1.2.0 is now available. The source code, documentation, and information are available at http://pauillac.inria.fr/whizzytex/ Bug reports to email@example.com This release is compatible (and required) with the freshly released version 1.6.0 of Active DVI. Conversely, version 1.6.0 of Active-DVI is required for this release to benefit from some of the new WhizzyTeX features. This release also contains several bug fixes and improvements since version 1.1. Significant and user-visible changes are: - Better support for debugging. - Duplex views: both the slice and the full document can now be viewed in the same Active DVI window. Switching between views can be done explicitly by typing 'w' or implicitly when clicking on cross-references that are outside of the current slice. - Support for whizzy-edition, which is especially usefull to seize scaling factors or dimensions by mouse. For more details see the web site. Enjoy, Didier Rémy PS: To keep informed of upgrades, check the WhizzyTeX WEB page occasionally, or just watch the content of the file http://pauillac.inria.fr/whizzytex/VERSION . ---------------- WhizzyTeX does not uses Ocaml, but it calls Active-DVI, which uses Ocaml :-) Ocaml inside || || \/ Emacs --> WhizzyTeX --> Active-DVI /\ | | | \________________________/
Archive: http://caml.inria.fr/archives/200410/msg00026.htmlRichard Jones said, Nicolas Cannasse asked, and Richard Jones answered:
Nicolas Cannasse wrote: > Richard Jones wrote: > > Note that there are at least 4 different ways to do web stuff with > > OCaml, all with their own pros and cons. At some point I intend to > > write up a summary, but in the meantime, here are the three (other) > > packages in no particular order. You can go to their web pages and > > read about them: > > Could you quickly sum up theses differences for this list readers ? > I'm recently interested in high level server side languages. > Any hint to show me what's "best" is apprecied. I'm not going to claim that any of the four approaches is best, but I will try to summarise them as far as my understanding goes. Please don't flame me too much for this; and do also note that I am the author of mod_caml. ** mod_caml mod_caml sits inside the Apache process, and its strengths and limitations derive from this fact. Because it's inside the process, it has full access to the Apache API, which means that you can, for example, make subrequests, or write an authentication handler, or write a more sane URL mapping system than mod_rewrite, or [coming soon, with Apache 2.0] use OCaml code to post-process the output of some other CGI script written in another language. It's completely tied to Apache. You have no other webserver choice once you've decided to use mod_caml. Apache preforks itself, so there are actually several instances of your code running, in separate processes, all working on separate HTTP requests. Because it uses Dynlink to load code, you can only use bytecode. (I would argue that most web applications are heavily IO bound, so this isn't a problem. But I can certainly imagine some compute-intensive application, or part of an application, where the lack of native compilation would be a serious shortcoming). It doesn't use Gerd's Netcgi module, but instead uses its own which is basically a reimplementation of Perl's Cgi.pm in OCaml. This is good news for ex-Perl refugees like me, of course. mod_caml itself is independent of ocamlnet, but I personally use quite a lot of ocamlnet functions. The 2.0 release of COCANWIKI will depend on ocamlnet for URL parsing, generating and parsing MIME emails, and maybe other stuff. It comes with a template library to enforce correct separation of code and HTML. You can see this in action by grabbing the COCANWIKI 1.0 distribution from http://sandbox.merjis.com/ and comparing the scripts/ and templates/ directories. ** ocamlnet & asxcaml ocamlnet runs outside the web server, using either FastCGI or JSERV to communicate with the web server. (Or you can run your scripts as ordinary CGI external programs, but I wouldn't recommend that for serious use). Your program is linked together into a single binary which, when started, is a FastCGI or JSERV server, and processes requests either sequentially or by forking a new process for each request. The webserver then acts as a proxy between the browser and your program. There are two important consequences of this: (1) You can use native code. (2) Your whole program is compiled together a single unit. There's no templating or database access, but you could easily add these by using mod_caml's templating system or CamlTemplate, and ocamldbi respectively. AS/XCaml is built on top of ocamlnet, and I'm not going to claim to fully understand it or even to have used it. However the big feature is the statically typed SQL implementation. This is a big improvement over ocamldbi (which can throw type errors at runtime if your database returns a field with an unexpected type). The reason I didn't do this for ocamldbi was because it would involve fully parsing every variant of SQL and/or limiting the complexity of SQL queries permitted. AS/XCaml uses an XML file to describe your database schema, and from this (I'm guessing) derives the schema and queries. In concept this is very similar to PDL [http://www.redhat.com/docs/manuals/waf/rhea-dg-waf-en-6.1/s1-pers-pdl.html]. ** mod_ocaml This is another Apache module. It's similar in concept to JSP or PHP. You actually embed OCaml code into your webpage. The webpage is then compiled (with ocamlc) and run on the fly. Your OCaml code prints HTML. Having worked in a professional web applications outfit for a few years, I can't in all conscience recommend embedding code into web pages which designers might try to edit.
Here is a quick trick to help you read this CWN if you are viewing it using vim (version 6 or greater).
If you know of a better way, please let me know.
If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.
If you also wish to receive it every week by mail, you may subscribe online.