Browse thread
Re: [Caml-list] Option functions (or lack thereof) + operator for composition
-
Thomas Gazagnaire
- Gabriel Kerneis
[
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: | Gabriel Kerneis <kerneis@p...> |
| Subject: | Re: [Caml-list] Option functions (or lack thereof) + operator for composition |
On Tue, Nov 16, 2010 at 12:43:30PM +0100, Thomas Gazagnaire wrote: > You are not forced to use match expression, you can just define : > let is_none x = match x with None -> true | Some _ -> false > and is_some x = not (is_none x) > and then use these functions in your code ... Or even simpler: let is_none = (=) None let is_some = (!=) None Note that you can use this directly, for instance: List.filter ((!=) None) l Best, -- Gabriel