X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=components%2Fextlib%2FhExtlib.ml;h=073c5695959480e657070af45a68ec3029132ef6;hb=2f857bf7f4d1bb73d08d270af9d7ad36a365a3c4;hp=d4572789ad55f39795d000fd09192e839cfee02f;hpb=ad17757edcc6cf75be576268fab8cf52751d679a;p=helm.git diff --git a/components/extlib/hExtlib.ml b/components/extlib/hExtlib.ml index d4572789a..073c56959 100644 --- a/components/extlib/hExtlib.ml +++ b/components/extlib/hExtlib.ml @@ -164,6 +164,17 @@ let list_rev_map_filter f l = in aux [] l +let list_rev_map_filter_fold f v l = + let rec aux v a = function + | [] -> v, a + | hd :: tl -> + begin match f v hd with + | v, None -> aux v a tl + | v, Some b -> aux v (b :: a) tl + end + in + aux v [] l + let list_concat ?(sep = []) = let rec aux acc = function