Browse thread
[Caml-list] Some/None
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Oliver Bandel <oliver@f...> |
| Subject: | Re: [Caml-list] Some/None |
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