Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Teaching OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-05-18 (08:52)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Teaching OCaml
On Mon, May 17, 2004 at 01:27:02PM -0400, Michael Hamburg wrote:
> Hi.
> A few thoughts on the subject.
> Iif you want practical features of OCaml, you could try the classic  
> "QuickSort in n lines" where n depends on how efficient you want to  
> make it, but you can still achieve O(n log n) in something like 4  
> lines.  It takes 10 or so to be efficient, compared to at least 50 in  
> C.  Of course, Haskell has even nicer syntax for this, but it looks  
> good in O'Caml too.

Sorry, but why is this a "practical" feature of OCaml?

Anyone who uses OCaml to sort things will use List.sort, unless they
have incredibly specialist sorting requirements, in which they
certainly won't be using a 4-line implementation of quicksort.

Frankly I don't care how List.sort is implemented, as long as it's (a)
reasonably fast, and (b) bug free.  It may be implemented in C for all
I know/care.

OCaml is a practical language for many good reasons:

(a) Garbage collection, type safety and other features which mean that
many bugs appear at compile time, not when your program has been deployed
at a customer site.

(b) Ability to construct and pattern-match against data structures
almost effortlessly.  Data-driven analysis programs like the sort of
stuff I write for work are a joy to code with these features.

(c) Speed - it's fast enough, and can be very fast when you need it to
be.  I can chew through datasets of hundreds of thousands of rows from
an Apache logfile in much less than a second.


Richard Jones.
Merjis Ltd. - improving website return on investment
MONOLITH is an advanced framework for writing web applications in C, easier
than using Perl & Java, much faster and smaller, reusable widget-based arch,
database-backed, discussion, chat, calendaring:

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: