From d7cbeba731716f176f4c116cfe92f3ec246e1396 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 21 Dec 2010 15:58:17 -0800 Subject: rustboot: Only bottom out at opaque IL types after finding two cycles. DON'T ASK ME WHY THIS WORKS. --- src/boot/util/common.ml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/boot/util') diff --git a/src/boot/util/common.ml b/src/boot/util/common.ml index 7a95573c..f9b18246 100644 --- a/src/boot/util/common.ml +++ b/src/boot/util/common.ml @@ -380,6 +380,13 @@ let rec list_drop n ls = else list_drop (n-1) (List.tl ls) ;; +let rec list_count elem lst = + match lst with + [] -> 0 + | h::t when h = elem -> 1 + (list_count elem t) + | _::t -> list_count elem t +;; + (* * Auxiliary pair functions. -- cgit v1.2.3