From cfbfe13f5b515ae2e3c6cdd97e2ccee03bc26e56 Mon Sep 17 00:00:00 2001 From: Stephane Glondu Date: Sun, 1 Feb 2009 00:54:40 +0100 Subject: Imported Upstream version 8.2~rc2+dfsg --- lib/option.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/option.ml') diff --git a/lib/option.ml b/lib/option.ml index 34749b8c..85efdd44 100644 --- a/lib/option.ml +++ b/lib/option.ml @@ -6,7 +6,7 @@ (* * GNU Lesser General Public License Version 2.1 *) (************************************************************************) -(*i $Id: option.ml 10739 2008-04-01 14:45:20Z herbelin $ i*) +(*i $Id: option.ml 11576 2008-11-10 19:13:15Z msozeau $ i*) (** Module implementing basic combinators for OCaml option type. It tries follow closely the style of OCaml standard library. @@ -97,6 +97,10 @@ let fold_right f x a = | Some y -> f y a | _ -> a +(** [cata f a x] is [a] if [x] is [None] and [f y] if [x] is [Some y]. *) +let cata f a = function + | Some c -> f c + | None -> a (** {6 More Specific operations} ***) -- cgit v1.2.3