Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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.

William

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners