src/Pure/library.ML
changeset 3246 7f783705c7a4
parent 3063 963e3bf01799
child 3365 86c0d1988622
equal deleted inserted replaced
3245:241838c01caf 3246:7f783705c7a4
   117   | orl (x :: xs) = x orelse orl xs;
   117   | orl (x :: xs) = x orelse orl xs;
   118 
   118 
   119 fun andl [] = true
   119 fun andl [] = true
   120   | andl (x :: xs) = x andalso andl xs;
   120   | andl (x :: xs) = x andalso andl xs;
   121 
   121 
   122 (*Needed because several object-logics declare the theory, therefore structure,
   122 (*Several object-logics declare theories named List or Option, hiding the
   123   List.*)
   123   eponymous basis library structures.*)
   124 structure List_ = List;
   124 structure List_ = List
       
   125 and       Option_ = Option;
   125 
   126 
   126 (*exists pred [x1, ..., xn] ===> pred x1 orelse ... orelse pred xn*)
   127 (*exists pred [x1, ..., xn] ===> pred x1 orelse ... orelse pred xn*)
   127 fun exists (pred: 'a -> bool) : 'a list -> bool =
   128 fun exists (pred: 'a -> bool) : 'a list -> bool =
   128   let fun boolf [] = false
   129   let fun boolf [] = false
   129         | boolf (x :: xs) = pred x orelse boolf xs
   130         | boolf (x :: xs) = pred x orelse boolf xs
   740 val warning_fn = ref(fn s => TextIO.output (TextIO.stdOut, s ^ "\n"));
   741 val warning_fn = ref(fn s => TextIO.output (TextIO.stdOut, s ^ "\n"));
   741 fun warning s = !warning_fn ("Warning: " ^ s);
   742 fun warning s = !warning_fn ("Warning: " ^ s);
   742 
   743 
   743 (*print error message and abort to top level*)
   744 (*print error message and abort to top level*)
   744 
   745 
   745 val error_fn = ref(fn s => TextIO.output (TextIO.stdOut, s ^ "\n"));
   746 val error_fn = ref(fn s => TextIO.output 
       
   747 		            (TextIO.stdOut, "\n*** " ^ s ^ "\n\n"));
   746 
   748 
   747 exception ERROR;
   749 exception ERROR;
   748 fun error msg = (!error_fn msg; raise ERROR);
   750 fun error msg = (!error_fn msg; raise ERROR);
   749 fun sys_error msg = (!error_fn "*** SYSTEM ERROR ***"; error msg);
   751 fun sys_error msg = (!error_fn "*** SYSTEM ERROR ***"; error msg);
   750 
   752