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
how can I express empty element?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Grünewald_Michaël <michaelgrunewald@y...>
Subject: Re: [Caml-list] how can I express empty element?

Le 9 mars 09 à 14:14, AUGER Cedric a écrit :

> David Rajchenbach-Teller wrote:
>> No, that's not possible. :: is an algebraic constructor, which means,
>> among other things, that it accepts no neutral element (well, except
>> when the list is infinite, but that's probably not what you're  
>> looking
>> for).
> And even if the list is infinite, I don't see any way to do it;
> but you can always define:

If `l' is only infinite list with type `unit list', then `l' is a  
neutral element for `::' constructor, but only for `unit list'.

(Well, that is reminiscent of your favourite «consider a topological  
space with two points, one open and one closed»-example, but I did not  
find a better one!)
Michaël G.