Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /smlnj-lib/trunk/Util/ord-map-sig.sml
ViewVC logotype

Annotation of /smlnj-lib/trunk/Util/ord-map-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3 - (view) (download)
Original Path: sml/branches/SMLNJ/src/smlnj-lib/Util/ord-map-sig.sml

1 : monnier 2 (* ord-map-sig.sml
2 :     *
3 :     * COPYRIGHT (c) 1996 by AT&T Research. See COPYRIGHT file for details.
4 :     *
5 :     * Abstract signature of an applicative-style finite maps (dictionaries)
6 :     * structure over ordered monomorphic keys.
7 :     *)
8 :    
9 :     signature ORD_MAP =
10 :     sig
11 :    
12 :     structure Key : ORD_KEY
13 :    
14 :     type 'a map
15 :    
16 :     val empty : 'a map
17 :     (* The empty map *)
18 :    
19 :     val insert : 'a map * Key.ord_key * 'a -> 'a map
20 :     (* Insert an item. *)
21 :    
22 :     val find : 'a map * Key.ord_key -> 'a option
23 :     (* Look for an item, return NONE if the item doesn't exist *)
24 :    
25 :     val remove : 'a map * Key.ord_key -> 'a map * 'a
26 :     (* Remove an item, returning new map and value removed.
27 :     * Raises LibBase.NotFound if not found.
28 :     *)
29 :    
30 :     val numItems : 'a map -> int
31 :     (* Return the number of items in the map *)
32 :    
33 :     val listItems : 'a map -> 'a list
34 :     val listItemsi : 'a map -> (Key.ord_key * 'a) list
35 :     (* Return an ordered list of the items (and their keys) in the map.
36 :     *)
37 :    
38 :     val collate : ('a * 'a -> order) -> ('a map * 'a map) -> order
39 :     (* given an ordering on the map's range, return an ordering
40 :     * on the map.
41 :     *)
42 :    
43 :     val unionWith : ('a * 'a -> 'a) -> ('a map * 'a map) -> 'a map
44 :     val unionWithi : (Key.ord_key * 'a * 'a -> 'a) -> ('a map * 'a map) -> 'a map
45 :     (* return a map whose domain is the union of the domains of the two input
46 :     * maps, using the supplied function to define the map on elements that
47 :     * are in both domains.
48 :     *)
49 :    
50 :     val intersectWith : ('a * 'b -> 'c) -> ('a map * 'b map) -> 'c map
51 :     val intersectWithi : (Key.ord_key * 'a * 'b -> 'c) -> ('a map * 'b map) -> 'c map
52 :     (* return a map whose domain is the intersection of the domains of the
53 :     * two input maps, using the supplied function to define the range.
54 :     *)
55 :    
56 :     val app : ('a -> unit) -> 'a map -> unit
57 :     val appi : ((Key.ord_key * 'a) -> unit) -> 'a map -> unit
58 :     (* Apply a function to the entries of the map in map order. *)
59 :    
60 :     val map : ('a -> 'b) -> 'a map -> 'b map
61 :     val mapi : (Key.ord_key * 'a -> 'b) -> 'a map -> 'b map
62 :     (* Create a new map by applying a map function to the
63 :     * name/value pairs in the map.
64 :     *)
65 :    
66 :     val foldl : ('a * 'b -> 'b) -> 'b -> 'a map -> 'b
67 :     val foldli : (Key.ord_key * 'a * 'b -> 'b) -> 'b -> 'a map -> 'b
68 :     (* Apply a folding function to the entries of the map
69 :     * in increasing map order.
70 :     *)
71 :    
72 :     val foldr : ('a * 'b -> 'b) -> 'b -> 'a map -> 'b
73 :     val foldri : (Key.ord_key * 'a * 'b -> 'b) -> 'b -> 'a map -> 'b
74 :     (* Apply a folding function to the entries of the map
75 :     * in decreasing map order.
76 :     *)
77 :    
78 :     val filter : ('a -> bool) -> 'a map -> 'a map
79 :     val filteri : (Key.ord_key * 'a -> bool) -> 'a map -> 'a map
80 :     (* Filter out those elements of the map that do not satisfy the
81 :     * predicate. The filtering is done in increasing map order.
82 :     *)
83 :    
84 :     val mapPartial : ('a -> 'b option) -> 'a map -> 'b map
85 :     val mapPartiali : (Key.ord_key * 'a -> 'b option) -> 'a map -> 'b map
86 :     (* map a partial function over the elements of a map in increasing
87 :     * map order.
88 :     *)
89 :    
90 :     end (* ORD_MAP *)

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0