diff src/core_env.sml @ 642:4a125bbc602d

Conversion of functions to CPS, to facilitate ServerCall
author Adam Chlipala <adamc@hcoop.net>
date Sun, 08 Mar 2009 20:34:21 -0400
parents 230654093b51
children 70cbdcf5989b
line wrap: on
line diff
--- a/src/core_env.sml	Sun Mar 08 13:41:55 2009 -0400
+++ b/src/core_env.sml	Sun Mar 08 20:34:21 2009 -0400
@@ -342,4 +342,13 @@
       | PCon (_, _, _, SOME p) => patBinds env p
       | PRecord xps => foldl (fn ((_, p, _), env) => patBinds env p) env xps
 
+fun patBindsN (p, loc) =
+    case p of
+        PWild => 0
+      | PVar _ => 1
+      | PPrim _ => 0
+      | PCon (_, _, _, NONE) => 0
+      | PCon (_, _, _, SOME p) => patBindsN p
+      | PRecord xps => foldl (fn ((_, p, _), count) => count + patBindsN p) 0 xps
+
 end