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 /sml/trunk/src/MLRISC/graphs/graph-comb.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/graphs/graph-comb.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 246 - (view) (download)

1 : monnier 245 structure GraphCombinations : GRAPH_COMBINATIONS =
2 :     struct
3 :    
4 :     structure G = Graph
5 :     structure Union = UnionGraphView
6 :     structure Rename = RenamedGraphView
7 :     structure Rev = ReversedGraphView
8 :    
9 :     (*
10 :     * Disjoint union
11 :     *)
12 :     fun my_union (a,b) = Union.union_view (fn (x,y) => x) (a, b)
13 :     fun sum (A as G.GRAPH a, B as G.GRAPH b) =
14 :     my_union(A, Rename.rename_view (#capacity a ()) B)
15 :     fun union [] = raise G.Graph "union"
16 :     | union [a] = a
17 :     | union [a,b] = my_union(a,b)
18 :     | union (a::b) = my_union(a,union b)
19 :    
20 :     fun sums [] = raise G.Graph "sums"
21 :     | sums [a] = a
22 :     | sums [a,b] = sum(a,b)
23 :     | sums (a::b) = sum(a,sums b)
24 :    
25 :     end
26 :    
27 :     (*
28 :     * $Log$
29 :     *)
30 :    

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