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] "List.index" or "List.unique" functions?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-05-01 (07:08)
From: William Lovas <wlovas@s...>
Subject: Re: [Caml-list] List.rev
On Sat, May 01, 2004 at 03:12:57PM +1000, skaller wrote:
> The term has no meaning without exhibiting implementation
> code, and it is usual for libraries to quite pointedly
> NOT do that: instead the behaviour is specified in
> terms of input and output of the function, and also
> side effects in terms of time and storage requirements
> are sometimes thrown in for more detail.

In many functional languages, O'Caml included, it's assumed that tail calls
are optimized to jumps, so that tail recursive functions do not allocate
any stack space for each recursive call.  (I believe in Scheme this is even
included in the language specification.)

With that in mind, you can read "This function is not tail recursive" as a
behavioral specification, "This function might terminate abnormally due to
stack overflow" -- and that's a useful side effect to document.


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