From ae83d3e44959b43c167ba83736055bf94ace3113 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 17 Sep 2009 16:35:11 -0400 Subject: Basic tail recursion introduction seems to be working --- src/core_untangle.sml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/core_untangle.sml') diff --git a/src/core_untangle.sml b/src/core_untangle.sml index 480ec7a4..f00bd95b 100644 --- a/src/core_untangle.sml +++ b/src/core_untangle.sml @@ -38,19 +38,20 @@ structure IM = IntBinaryMap fun default (k, s) = s fun exp thisGroup (e, s) = - case e of - ENamed n => - if IS.member (thisGroup, n) then - IS.add (s, n) - else - s - | EClosure (n, _) => - if IS.member (thisGroup, n) then - IS.add (s, n) - else - s - - | _ => s + let + fun try n = + if IS.member (thisGroup, n) then + IS.add (s, n) + else + s + in + case e of + ENamed n => try n + | EClosure (n, _) => try n + | EServerCall (n, _, _, _, _) => try n + | ETailCall (n, _, _, _, _) => try n + | _ => s + end fun untangle file = let -- cgit v1.2.3