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 output type
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-03-24 (19:41)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] output type
On Thu, Mar 24, 2005 at 07:47:23PM +0100, Alex Baretta wrote:
> currently returns an int. Intuitively it would be 
> more appropriate for it to return a union type such as the following.
> type comparison_result = Less | Equals | Greater
> What are the reasons behind the present design choice?

Wouldn't it be for speed?  You could define over
integers just as a subtraction.  For strings, you can write a loop
which looks character-by-character over the strings, subtracting one
character from another, and if the result is non-zero, return that
result directly (else keep iterating).


Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology -
Team Notepad - intranets and extranets for business -