From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA21074; Wed, 24 Apr 2002 16:00:04 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA21912 for ; Wed, 24 Apr 2002 16:00:03 +0200 (MET DST) Received: from hirsch.in-berlin.de (hirsch.in-berlin.de [192.109.42.6]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g3OE03115541 for ; Wed, 24 Apr 2002 16:00:03 +0200 (MET DST) Received: from hirsch.in-berlin.de (localhost [127.0.0.1]) by hirsch.in-berlin.de (8.12.1/8.12.1/Debian -2) with ESMTP id g3OE02TL023055 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NOT) for ; Wed, 24 Apr 2002 16:00:02 +0200 Received: (from uucp@localhost) by hirsch.in-berlin.de (8.12.1/8.12.1/Debian -2) with UUCP id g3OE02Pj023046 for caml-list@inria.fr; Wed, 24 Apr 2002 16:00:02 +0200 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: caml-list@inria.fr Received: from localhost (oliver@localhost) by first.in-berlin.de (8.7.6/8.7.3) with SMTP id PAA01344 for ; Wed, 24 Apr 2002 15:50:05 +0200 Date: Wed, 24 Apr 2002 15:50:05 +0200 (MET DST) From: Oliver Bandel To: caml-list@inria.fr Subject: Re: [Caml-list] Some/None In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Ok, I try an explanation, and you can comment it. On Wed, 24 Apr 2002, Oliver Bandel wrote: [...] > How are Some/None defined, what are they good for? To have a boolean choice and depending on that choice giving back a value of arbitrary type (or of type option). > > A small, simple example will help a lot. Hmhhh. I looked again into the answer of John Prevost (my question on Stack overflow in try-statement) and I'm close to understanding it. [...] > Can you explain me this type? Hmhh, weell, errr,, hmmhhh... The type option gives two choices: None or Some (== everything (?)). A condition does not match => None A condition does match => Some of arbritary type. The Some/None-identifiers (constructors) can be used for my is_regularfile-problem too, I think. But I have to think about it in more detail. Does it make sense to give back None/Some out of a function (e.g. is_regularfile/is_directory/...) or is it only useful inside functions in try- and match-statements? Any correction of the above and any other explanations are welcome... Ciao, Oliver ------------------- 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