39348
|
1 |
(* ========================================================================= *)
|
|
2 |
(* PRESERVING SHARING OF ML VALUES *)
|
39444
|
3 |
(* Copyright (c) 2005 Joe Hurd, distributed under the BSD License *)
|
39348
|
4 |
(* ========================================================================= *)
|
|
5 |
|
|
6 |
signature Sharing =
|
|
7 |
sig
|
|
8 |
|
|
9 |
(* ------------------------------------------------------------------------- *)
|
|
10 |
(* Option operations. *)
|
|
11 |
(* ------------------------------------------------------------------------- *)
|
|
12 |
|
|
13 |
val mapOption : ('a -> 'a) -> 'a option -> 'a option
|
|
14 |
|
|
15 |
val mapsOption : ('a -> 's -> 'a * 's) -> 'a option -> 's -> 'a option * 's
|
|
16 |
|
|
17 |
(* ------------------------------------------------------------------------- *)
|
|
18 |
(* List operations. *)
|
|
19 |
(* ------------------------------------------------------------------------- *)
|
|
20 |
|
|
21 |
val map : ('a -> 'a) -> 'a list -> 'a list
|
|
22 |
|
|
23 |
val revMap : ('a -> 'a) -> 'a list -> 'a list
|
|
24 |
|
|
25 |
val maps : ('a -> 's -> 'a * 's) -> 'a list -> 's -> 'a list * 's
|
|
26 |
|
|
27 |
val revMaps : ('a -> 's -> 'a * 's) -> 'a list -> 's -> 'a list * 's
|
|
28 |
|
|
29 |
val updateNth : int * 'a -> 'a list -> 'a list
|
|
30 |
|
|
31 |
val setify : ''a list -> ''a list
|
|
32 |
|
|
33 |
(* ------------------------------------------------------------------------- *)
|
|
34 |
(* Function caching. *)
|
|
35 |
(* ------------------------------------------------------------------------- *)
|
|
36 |
|
|
37 |
val cache : ('a * 'a -> order) -> ('a -> 'b) -> 'a -> 'b
|
|
38 |
|
|
39 |
(* ------------------------------------------------------------------------- *)
|
|
40 |
(* Hash consing. *)
|
|
41 |
(* ------------------------------------------------------------------------- *)
|
|
42 |
|
|
43 |
val hashCons : ('a * 'a -> order) -> 'a -> 'a
|
|
44 |
|
|
45 |
end
|