Previous week Up Next week

Hello

Here is the latest Caml Weekly News, for the week of 22 to 29 November, 2005.

  1. Mandelbrot renderer
  2. polymorphic fixpoints operator in Ocaml
  3. Interface to Boom SMS (text message service)
  4. HDCaml 0.2.5 -- SystemC Support
  5. Physical compare
  6. Library for reading and writing CSV (comma-separated values) files
  7. findlib-1.1.1 released
  8. ile ou un remplacement?

Mandelbrot renderer

Archive: http://thread.gmane.org/gmane.comp.lang.caml.general/31458

Jon Harrop announced:
Following Oliver's objections regarding the lack of serious software written 
in OCaml (e.g. web servers), I have written a very serious Mandelbrot 
renderer. The program is 35 lines of OCaml and renders using OpenGL. This 
page breaks it down and describes how it works:

  http://www.ffconsultancy.com/free/fractal

I've written a simple, recursive C++ version as well. It weighs in at 45 lines 
but only 6% more bytes. If you specialise the complex-number arithmetic in 
the OCaml:

  let rec mandelbrot i cx cy zx zy =
    if i = 63 || zx *. zx +. zy *. zy > 4. then i else
      let zx = zx *. zx -. zy *. zy and zy = 2. *. zx *. zy in
      mandelbrot (i+1) cx cy (zx +. cx) (zy +. cy)

then, with only -O3, the C++ is actually significantly slower. The performance 
of the C++ improves considerably with -ffast-math so that it is slightly 
faster. The performance of the C++ can be further improved by using an 
imperative style. This is on both AMD64 and x86.
    

polymorphic fixpoints operator in Ocaml

Archive: http://thread.gmane.org/gmane.comp.lang.caml.general/31459

Jacques Carette announced:
Inspired by Julien Signoles' code for Omega, (http://www.lri.fr/~signoles/prog/misc/lambda.ml.html) Oleg K explores different ways to create a *fully polymorphic* fixpoint operator in Ocaml.  See 

    http://pobox.com/~oleg/ftp/packages/fixpoints.ml 

for details.
    

Interface to Boom SMS (text message service)

Archive: http://thread.gmane.org/gmane.comp.lang.caml.general/31476

Richard Jones announced:
Not likely to be of wide interest, but we have implemented a simple
interface to the commercial Boom SMS (text message sending) service.
We use this to generate alerts when significant things happen while
automatically bidding on Google Adwords.

http://merjis.com/developers/boomsms

License is LGPL + OCaml linking exception.

Interface: http://resources.merjis.com/developers/boomsms/BoomSMS.html

Read more about the commercial service here.  If you want to test it,
they will give you up to 50 free text messages (if you ask them).

http://sms.boom-sms.co.uk/
    

HDCaml 0.2.5 -- SystemC Support

Archive: http://thread.gmane.org/gmane.comp.lang.confluence/405

Tom Hawkins announced:
HDCaml is a hardware design and verification language embedded in OCaml.

With release 0.2.5, HDCaml now produces cycle and bit accurate C models 
for simulation.  In addition to the logic primitives, the C models also 
support basic assertions of the form:

   assertion "label" (always (prop (some_signal)));

The C models include a SystemC wrapper for integration into any SystemC 
environment.  The wrapper is currently untested, so feedback from any 
SystemC user is appreciated.  Thanks!

http://www.confluent.org/
    

Physical compare

Archive: http://thread.gmane.org/gmane.comp.lang.caml.general/31485

Tom Hawkins asked and Nicolas Cannasse answered:
> Is their a version of "compare" that is based on physical equality?  If 
> not, how can I define one?  I tried:
> 
> let compareq a b = if a == b then 0 else if a > b then 1 else (-1)
> 
> But unfortunately, (>) is a structural comparison.
> 
> I need to make a Map where the keys are distinguished by the physical 
> instance.

It's not possible.

One of the reason is that the GC might move your memory addresses around 
and then break your Map constitency. You need to attribute an unique id 
to each of your items and use it for comparison.
    
Jon Harrop suggested:
Tag every key with a unique integer using something like this:

module Tag : sig
  type 'a t
  val make : 'a -> 'a t
  val compare : 'a t -> 'a t -> int
end = struct
  type 'a t = int * 'a
  let i = ref 0
  let make x =
    incr i;
    !i, x
  let compare (a, _) (b, _) = compare a b
end;;

Then use the Tag.compare function to perform physical comparison with a total 
ordering.
    
Jean-Christophe Filliatre also suggested:
Others already  gave the right answer  i.e. that you need  to tag your
values with unique integers to do that.

Just to  mention it, I wrote  a little hash-consing  library that does
precisely this, together with specialized  versions of Set and Map for
these tagged values  (based on Patricia trees). There  is even a short
article describing the technique. All is available on this page:

http://www.lri.fr/~filliatr/software.en.html
    

Library for reading and writing CSV (comma-separated values) files

Archive: http://thread.gmane.org/gmane.comp.lang.caml.general/31509

Richard Jones announced:
Version 1.1.0 has been released.

Download: http://merjis.com/developers/csv
Documentation: http://resources.merjis.com/developers/csv/Csv.html
    

findlib-1.1.1 released

Archive: http://thread.gmane.org/gmane.comp.lang.caml.general/31531

Gerd Stolpmann announced:
there is a new version of findlib (1.1.1) with two minor bug fixes,
especially for O'Caml 3.09.

See http://www.ocaml-programming.de/packages/documentation/findlib/
for documentation and links. See
http://www.ocaml-programming.de/packages/
for downloads.
    

ile ou un remplacement?

Archive: http://thread.gmane.org/gmane.comp.lang.caml.general/31535

Christopher Alexander Stein asked:
J'avais l'habitude d'avoir une utilité très commode pour Caml; la ligne éditant 
"ile" qui envelopperait l'interprèteur. Je puis plus ne le trouver sur le web.  
N'importe qui savent où il est ou suggèrent un remplacement?

(Editor's translation: the poster is looking for the line editor "ile" or a 
remplacement that would allow him, when using it with the toplevel, to have a 
better line editing experience.)
    
Eric Cooper suggested:
Try ledit, available as a Debian package or from
   ftp://ftp.inria.fr/INRIA/cristal/Daniel.de_Rauglaudre/Tools/
    
Michael Wohlwend suggested:
there is also rlwrap which is easier to use. (readline wrap)
    
Martin Jambon suggested:
There is some useful information there, and you are welcome to contribute 
too:
    http://wiki.cocan.org/tips_for_using_the_ocaml_toplevel
    
Alain Frisch said:
Google donne ce lien:

http://ocaml.info/ocaml_sources/ile-2.7/
    

Using folding to read the cwn in vim 6+

Here is a quick trick to help you read this CWN if you are viewing it using vim (version 6 or greater).

:set foldmethod=expr
:set foldexpr=getline(v:lnum)=~'^=\\{78}$'?'<1':1
zM

If you know of a better way, please let me know.


Old cwn

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.


Alan Schmitt