src/Tools/isac/calcelems.sml
branchisac-update-Isa09-2
changeset 38050 4c52ad406c20
parent 38042 26f3832d96b2
child 38051 efdeff9df986
equal deleted inserted replaced
38049:02a1cce684a7 38050:4c52ad406c20
   239 val theory2domID = string_of_thy;
   239 val theory2domID = string_of_thy;
   240 val theory2thyID = (get_thy o string_of_thy) : theory -> thyID;
   240 val theory2thyID = (get_thy o string_of_thy) : theory -> thyID;
   241 val theory2theory' = string_of_thy;
   241 val theory2theory' = string_of_thy;
   242 val theory2str = string_of_thy; (*WN050903 ..most consistent naming*)
   242 val theory2str = string_of_thy; (*WN050903 ..most consistent naming*)
   243 val theory2str' = implode o (drop_last_n 4) o explode o string_of_thy;
   243 val theory2str' = implode o (drop_last_n 4) o explode o string_of_thy;
   244 (*> theory2str' Isac.thy;
   244 (*> theory2str' (theory "Isac");
   245 al it = "Isac" : string
   245 al it = "Isac" : string
   246 *)
   246 *)
   247 
   247 
   248 fun thyID2theory' (thyID:thyID) =
   248 fun thyID2theory' (thyID:thyID) =
   249     let val ss = explode thyID
   249     let val ss = explode thyID
   250 	val ext = implode (takelast (4, ss))
   250 	val ext = implode (takelast (4, ss))
   251     in if ext = ".thy" then thyID : theory' (*disarm abuse of thyID*)
   251     in if ext = ".thy" then thyID : theory' (*disarm abuse of thyID*)
   252        else thyID ^ ".thy"
   252        else thyID ^ ".thy"
   253     end;
   253     end;
   254 (* thyID2theory' "Isac" (*ok*);
   254 (* thyID2theory' "Isac" (*ok*);
   255 val it = "Isac.thy" : theory'
   255 val it = "Isac" : theory'
   256  > thyID2theory' "Isac.thy" (*abuse, goes ok...*);
   256  > thyID2theory' "Isac" (*abuse, goes ok...*);
   257 val it = "Isac.thy" : theory'
   257 val it = "Isac" : theory'
   258 *)
   258 *)
   259 
   259 
   260 fun theory'2thyID (theory':theory') =
   260 fun theory'2thyID (theory':theory') =
   261     let val ss = explode theory'
   261     let val ss = explode theory'
   262 	val ext = implode (takelast (4, ss))
   262 	val ext = implode (takelast (4, ss))
   263     in if ext = ".thy" then ((implode o (drop_last_n 4)) ss) : thyID
   263     in if ext = ".thy" then ((implode o (drop_last_n 4)) ss) : thyID
   264        else theory' (*disarm abuse of theory'*)
   264        else theory' (*disarm abuse of theory'*)
   265     end;
   265     end;
   266 (* theory'2thyID "Isac.thy";
   266 (* theory'2thyID "Isac";
   267 val it = "Isac" : thyID
   267 val it = "Isac" : thyID
   268 > theory'2thyID "Isac";
   268 > theory'2thyID "Isac";
   269 val it = "Isac" : thyID*)
   269 val it = "Isac" : thyID*)
   270 
   270 
   271 
   271