3302
|
1 |
(* Title: TFL/utils
|
|
2 |
ID: $Id$
|
|
3 |
Author: Konrad Slind, Cambridge University Computer Laboratory
|
|
4 |
Copyright 1997 University of Cambridge
|
|
5 |
|
|
6 |
Basic utilities
|
|
7 |
*)
|
|
8 |
|
2112
|
9 |
signature Utils_sig =
|
|
10 |
sig
|
|
11 |
(* General error format and reporting mechanism *)
|
|
12 |
exception ERR of {module:string,func:string, mesg:string}
|
|
13 |
val Raise : exn -> 'a
|
|
14 |
|
|
15 |
val can : ('a -> 'b) -> 'a -> bool
|
|
16 |
val holds : ('a -> bool) -> 'a -> bool
|
|
17 |
val C : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
|
|
18 |
|
|
19 |
(* Set operations *)
|
|
20 |
val mem : ('a -> 'a -> bool) -> 'a -> 'a list -> bool
|
|
21 |
val set_diff : ('a -> 'b -> bool) -> 'a list -> 'b list -> 'a list
|
|
22 |
val mk_set : ('a -> 'a -> bool) -> 'a list -> 'a list
|
|
23 |
|
|
24 |
val itlist : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
|
|
25 |
val rev_itlist : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
|
|
26 |
val end_itlist : ('a -> 'a -> 'a) -> 'a list -> 'a
|
|
27 |
val itlist2 :('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
|
|
28 |
val mapfilter : ('a -> 'b) -> 'a list -> 'b list
|
|
29 |
val pluck : ('a -> bool) -> 'a list -> 'a * 'a list
|
|
30 |
val front_back : 'a list -> 'a list * 'a
|
|
31 |
val zip3 : 'a list -> 'b list -> 'c list -> ('a*'b*'c) list
|
|
32 |
val take : ('a -> 'b) -> int * 'a list -> 'b list
|
|
33 |
val sort : ('a -> 'a -> bool) -> 'a list -> 'a list
|
|
34 |
val concat : string -> string -> string
|
|
35 |
val quote : string -> string
|
|
36 |
|
|
37 |
end;
|
|
38 |
|