removed unused space_of;
authorwenzelm
Wed, 16 Apr 2008 21:53:00 +0200
changeset 26692 3f48d4f4229f
parent 26691 520c99e0b9a0
child 26693 90d0b86644ac
removed unused space_of; added defined, fold_static; renamed dest_table to dest_static; renamed extern_table to extern_static;
src/Pure/facts.ML
--- a/src/Pure/facts.ML	Wed Apr 16 21:52:59 2008 +0200
+++ b/src/Pure/facts.ML	Wed Apr 16 21:53:00 2008 +0200
@@ -21,12 +21,13 @@
   val selections: string * thm list -> (ref * thm) list
   type T
   val empty: T
-  val space_of: T -> NameSpace.T
   val intern: T -> xstring -> string
   val extern: T -> string -> xstring
   val lookup: Context.generic -> T -> string -> thm list option
-  val dest_table: T -> (string * thm list) list
-  val extern_table: T -> (xstring * thm list) list
+  val defined: T -> string -> bool
+  val fold_static: (string * thm list -> 'a -> 'a) -> T -> 'a -> 'a
+  val dest_static: T -> (string * thm list) list
+  val extern_static: T -> (xstring * thm list) list
   val props: T -> thm list
   val could_unify: T -> term -> thm list
   val merge: T * T -> T
@@ -138,19 +139,19 @@
 val intern = NameSpace.intern o space_of;
 val extern = NameSpace.extern o space_of;
 
+val defined = Symtab.defined o table_of;
+
 fun lookup context facts name =
   (case Symtab.lookup (table_of facts) name of
     NONE => NONE
   | SOME (Static ths, _) => SOME ths
   | SOME (Dynamic f, _) => SOME (f context));
 
-fun dest_table facts =
-  Symtab.fold (fn (name, (Static ths, _)) => cons (name, ths) | _ => I) (table_of facts) [];
+fun fold_static f = Symtab.fold (fn (name, (Static ths, _)) => f (name, ths) | _ => I) o table_of;
 
-fun extern_table facts =
-  dest_table facts
-  |> map (apfst (extern facts))
-  |> sort_wrt #1;
+fun dest_static facts = sort_wrt #1 (fold_static cons facts []);
+fun extern_static facts =
+  sort_wrt #1 (fold_static (fn (name, ths) => cons (extern facts name, ths)) facts []);
 
 
 (* indexed props *)