Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: [Caml-list] Operator overloading
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Operator overloading
On Fri, 2007-03-09 at 10:32 +0100, Tom wrote:
> 
> On 09/03/07, skaller <skaller@users.sourceforge.net> wrote:
>         
>         Actually, length can be defined in turns of fold:
>         
>         let len x = fold (fun acc elt -> acc + 1) 0 container
> 
> Yes, as long as x is a container. But how are you going to define a
> length of a snake using fold? 

That's a different kind of length. Now if you said 'worm'
there would be two kinds of length to define:

(a) the length in metres
(b) the number of segments

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net