From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id C1614BC57 for ; Tue, 16 Nov 2010 12:51:36 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAGv/4UzVujhf/2dsb2JhbACiXHG+Y4VLBA X-IronPort-AV: E=Sophos;i="4.59,206,1288566000"; d="scan'208";a="78855020" Received: from witko.kerneis.info ([213.186.56.95]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 16 Nov 2010 12:51:36 +0100 Received: from [2001:660:3301:8061:21c:25ff:fecf:737a] (helo=rhodium.pps.jussieu.fr) by witko.kerneis.info with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1PIK4V-0005rW-SN; Tue, 16 Nov 2010 12:51:35 +0100 Received: from kerneis by rhodium.pps.jussieu.fr with local (Exim 4.72) (envelope-from ) id 1PIK4B-0001es-56; Tue, 16 Nov 2010 12:51:15 +0100 Date: Tue, 16 Nov 2010 12:51:15 +0100 From: Gabriel Kerneis To: Thomas Gazagnaire Cc: Serge Le Huitouze , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Option functions (or lack thereof) + operator for composition Message-ID: <20101116115115.GA4149@rhodium.pps.jussieu.fr> References: <1853021343.44703.1289906871683.JavaMail.root@zmbs4.inria.fr> <1289907810.2954.148.camel@saorge.inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1289907810.2954.148.camel@saorge.inria.fr> User-Agent: Mutt/1.5.20 (2009-06-14) X-SA-Exim-Connect-IP: 2001:660:3301:8061:21c:25ff:fecf:737a X-SA-Exim-Mail-From: kerneis@pps.jussieu.fr X-SA-Exim-Scanned: No (on witko.kerneis.info); SAEximRunCond expanded to false X-Spam: no; 0.00; 0100,:01 wrote:01 pps:01 caml-list:01 functions:01 functions:01 jussieu:01 define:02 expression:02 match:02 match:02 let:03 let:03 simpler:05 tue:06 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