summaryrefslogtreecommitdiff
path: root/cil/doc/api/Clist.html
blob: 27f373e50499e34658aa3483f51f4d43a0e9a61f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="Start" href="index.html">
<link rel="previous" href="Errormsg.html">
<link rel="next" href="Stats.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of class types" rel=Appendix href="index_class_types.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Pretty" rel="Chapter" href="Pretty.html">
<link title="Errormsg" rel="Chapter" href="Errormsg.html">
<link title="Clist" rel="Chapter" href="Clist.html">
<link title="Stats" rel="Chapter" href="Stats.html">
<link title="Cil" rel="Chapter" href="Cil.html">
<link title="Formatcil" rel="Chapter" href="Formatcil.html">
<link title="Alpha" rel="Chapter" href="Alpha.html">
<link title="Cillower" rel="Chapter" href="Cillower.html">
<link title="Cfg" rel="Chapter" href="Cfg.html">
<link title="Dataflow" rel="Chapter" href="Dataflow.html">
<link title="Dominators" rel="Chapter" href="Dominators.html"><title>CIL API Documentation (version 1.3.5) : Clist</title>
</head>
<body>
<div class="navbar"><a href="Errormsg.html">Previous</a>
&nbsp;<a href="index.html">Up</a>
&nbsp;<a href="Stats.html">Next</a>
</div>
<center><h1>Module <a href="type_Clist.html">Clist</a></h1></center>
<br>
<pre><span class="keyword">module</span> Clist: <code class="code">sig</code> <a href="Clist.html">..</a> <code class="code">end</code></pre>Utilities for managing "concatenable lists" (clists). We often need to
    concatenate sequences, and using lists for this purpose is expensive. This
    module provides routines to manage such lists more efficiently. In this
    model, we never do cons or append explicitly. Instead we maintain
    the elements of the list in a special data structure. Routines are provided
    to convert to/from ordinary lists, and carry out common list operations.<br>
<hr width="100%">
<br><code><span class="keyword">type</span> <a name="TYPEclist"></a><code class="type">'a</code> clist = </code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">CList</span> <span class="keyword">of</span> <code class="type">'a list</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>The only representation for the empty 
                                     list. Try to use sparingly.</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">CConsL</span> <span class="keyword">of</span> <code class="type">'a * 'a <a href="Clist.html#TYPEclist">clist</a></code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>Do not use this a lot because scanning 
 it is not tail recursive</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">CConsR</span> <span class="keyword">of</span> <code class="type">'a <a href="Clist.html#TYPEclist">clist</a> * 'a</code></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">CSeq</span> <span class="keyword">of</span> <code class="type">'a <a href="Clist.html#TYPEclist">clist</a> * 'a <a href="Clist.html#TYPEclist">clist</a></code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code>We concatenate only two of them at this
                                    time. Neither is the empty clist. To be
                                    sure always use append to make these</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info">
The clist datatype. A clist can be an ordinary list, or a clist preceded 
    or followed by an element, or two clists implicitly appended together<br>
</div>

<pre><span class="keyword">val</span> <a name="VALtoList"></a>toList : <code class="type">'a <a href="Clist.html#TYPEclist">clist</a> -> 'a list</code></pre><div class="info">
Convert a clist to an ordinary list<br>
</div>
<pre><span class="keyword">val</span> <a name="VALfromList"></a>fromList : <code class="type">'a list -> 'a <a href="Clist.html#TYPEclist">clist</a></code></pre><div class="info">
Convert an ordinary list to a clist<br>
</div>
<pre><span class="keyword">val</span> <a name="VALsingle"></a>single : <code class="type">'a -> 'a <a href="Clist.html#TYPEclist">clist</a></code></pre><div class="info">
Create a clist containing one element<br>
</div>
<pre><span class="keyword">val</span> <a name="VALempty"></a>empty : <code class="type">'a <a href="Clist.html#TYPEclist">clist</a></code></pre><div class="info">
The empty clist<br>
</div>
<pre><span class="keyword">val</span> <a name="VALappend"></a>append : <code class="type">'a <a href="Clist.html#TYPEclist">clist</a> -> 'a <a href="Clist.html#TYPEclist">clist</a> -> 'a <a href="Clist.html#TYPEclist">clist</a></code></pre><div class="info">
Append two clists<br>
</div>
<pre><span class="keyword">val</span> <a name="VALcheckBeforeAppend"></a>checkBeforeAppend : <code class="type">'a <a href="Clist.html#TYPEclist">clist</a> -> 'a <a href="Clist.html#TYPEclist">clist</a> -> bool</code></pre><div class="info">
A useful check to assert before an append. It checks that the two lists 
 are not identically the same (Except if they are both empty)<br>
</div>
<pre><span class="keyword">val</span> <a name="VALlength"></a>length : <code class="type">'a <a href="Clist.html#TYPEclist">clist</a> -> int</code></pre><div class="info">
Find the length of a clist<br>
</div>
<pre><span class="keyword">val</span> <a name="VALmap"></a>map : <code class="type">('a -> 'b) -> 'a <a href="Clist.html#TYPEclist">clist</a> -> 'b <a href="Clist.html#TYPEclist">clist</a></code></pre><div class="info">
Map a function over a clist. Returns another clist<br>
</div>
<pre><span class="keyword">val</span> <a name="VALfold_left"></a>fold_left : <code class="type">('a -> 'b -> 'a) -> 'a -> 'b <a href="Clist.html#TYPEclist">clist</a> -> 'a</code></pre><div class="info">
A version of fold_left that works on clists<br>
</div>
<pre><span class="keyword">val</span> <a name="VALiter"></a>iter : <code class="type">('a -> unit) -> 'a <a href="Clist.html#TYPEclist">clist</a> -> unit</code></pre><div class="info">
A version of iter that works on clists<br>
</div>
<pre><span class="keyword">val</span> <a name="VALrev"></a>rev : <code class="type">('a -> 'a) -> 'a <a href="Clist.html#TYPEclist">clist</a> -> 'a <a href="Clist.html#TYPEclist">clist</a></code></pre><div class="info">
Reverse a clist. The first function reverses an element.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALdocCList"></a>docCList : <code class="type"><a href="Pretty.html#TYPEdoc">Pretty.doc</a> -> ('a -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a>) -> unit -> 'a <a href="Clist.html#TYPEclist">clist</a> -> <a href="Pretty.html#TYPEdoc">Pretty.doc</a></code></pre><div class="info">
A document for printing a clist (similar to <code class="code">docList</code>)<br>
</div>
</body></html>