TFL/utils.sml
changeset 9867 bf8300fa4238
parent 3391 5e45dd3b64e9
child 9876 a069795f1060
equal deleted inserted replaced
9866:90cbf68b9227 9867:bf8300fa4238
     1 (*  Title:      TFL/utils
     1 (*  Title:      TFL/utils.sml
     2     ID:         $Id$
     2     ID:         $Id$
     3     Author:     Konrad Slind, Cambridge University Computer Laboratory
     3     Author:     Konrad Slind, Cambridge University Computer Laboratory
     4     Copyright   1997  University of Cambridge
     4     Copyright   1997  University of Cambridge
     5 
     5 
     6 Basic utilities
     6 Basic utilities.
     7 *)
     7 *)
       
     8 
       
     9 signature Utils_sig =
       
    10 sig
       
    11   exception ERR of {module:string,func:string, mesg:string}
       
    12 
       
    13   val can   : ('a -> 'b) -> 'a -> bool
       
    14   val holds : ('a -> bool) -> 'a -> bool
       
    15   val C : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
       
    16 
       
    17   val itlist : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
       
    18   val rev_itlist : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
       
    19   val end_itlist : ('a -> 'a -> 'a) -> 'a list -> 'a
       
    20   val itlist2 :('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
       
    21   val pluck : ('a -> bool) -> 'a list -> 'a * 'a list
       
    22   val zip3 : 'a list -> 'b list -> 'c list -> ('a*'b*'c) list
       
    23   val take  : ('a -> 'b) -> int * 'a list -> 'b list
       
    24   val sort  : ('a -> 'a -> bool) -> 'a list -> 'a list
       
    25 
       
    26 end;
       
    27 
     8 
    28 
     9 structure Utils = 
    29 structure Utils = 
    10 struct
    30 struct
    11 
    31 
    12 (* Standard exception for TFL. *)
    32 (* Standard exception for TFL. *)