mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
184 lines
No EOL
12 KiB
HTML
184 lines
No EOL
12 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<link rel="stylesheet" href="style.css" type="text/css">
|
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
|
<link rel="Start" href="index.html">
|
|
<link rel="previous" href="CCHet.html">
|
|
<link rel="next" href="CCPool.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 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="CCVector" rel="Chapter" href="CCVector.html">
|
|
<link title="CCHeap" rel="Chapter" href="CCHeap.html">
|
|
<link title="CCList" rel="Chapter" href="CCList.html">
|
|
<link title="CCOpt" rel="Chapter" href="CCOpt.html">
|
|
<link title="CCPair" rel="Chapter" href="CCPair.html">
|
|
<link title="CCFun" rel="Chapter" href="CCFun.html">
|
|
<link title="CCHash" rel="Chapter" href="CCHash.html">
|
|
<link title="CCInt" rel="Chapter" href="CCInt.html">
|
|
<link title="CCBool" rel="Chapter" href="CCBool.html">
|
|
<link title="CCFloat" rel="Chapter" href="CCFloat.html">
|
|
<link title="CCArray" rel="Chapter" href="CCArray.html">
|
|
<link title="CCRef" rel="Chapter" href="CCRef.html">
|
|
<link title="CCSet" rel="Chapter" href="CCSet.html">
|
|
<link title="CCOrd" rel="Chapter" href="CCOrd.html">
|
|
<link title="CCRandom" rel="Chapter" href="CCRandom.html">
|
|
<link title="CCString" rel="Chapter" href="CCString.html">
|
|
<link title="CCHashtbl" rel="Chapter" href="CCHashtbl.html">
|
|
<link title="CCMap" rel="Chapter" href="CCMap.html">
|
|
<link title="CCFormat" rel="Chapter" href="CCFormat.html">
|
|
<link title="CCIO" rel="Chapter" href="CCIO.html">
|
|
<link title="CCInt64" rel="Chapter" href="CCInt64.html">
|
|
<link title="CCChar" rel="Chapter" href="CCChar.html">
|
|
<link title="CCResult" rel="Chapter" href="CCResult.html">
|
|
<link title="CCParse" rel="Chapter" href="CCParse.html">
|
|
<link title="CCArray_slice" rel="Chapter" href="CCArray_slice.html">
|
|
<link title="CCListLabels" rel="Chapter" href="CCListLabels.html">
|
|
<link title="CCArrayLabels" rel="Chapter" href="CCArrayLabels.html">
|
|
<link title="Containers" rel="Chapter" href="Containers.html">
|
|
<link title="CCKTree" rel="Chapter" href="CCKTree.html">
|
|
<link title="CCKList" rel="Chapter" href="CCKList.html">
|
|
<link title="CCLazy_list" rel="Chapter" href="CCLazy_list.html">
|
|
<link title="CCMultiMap" rel="Chapter" href="CCMultiMap.html">
|
|
<link title="CCMultiSet" rel="Chapter" href="CCMultiSet.html">
|
|
<link title="CCTrie" rel="Chapter" href="CCTrie.html">
|
|
<link title="CCFlatHashtbl" rel="Chapter" href="CCFlatHashtbl.html">
|
|
<link title="CCCache" rel="Chapter" href="CCCache.html">
|
|
<link title="CCPersistentHashtbl" rel="Chapter" href="CCPersistentHashtbl.html">
|
|
<link title="CCDeque" rel="Chapter" href="CCDeque.html">
|
|
<link title="CCFQueue" rel="Chapter" href="CCFQueue.html">
|
|
<link title="CCBV" rel="Chapter" href="CCBV.html">
|
|
<link title="CCMixtbl" rel="Chapter" href="CCMixtbl.html">
|
|
<link title="CCMixmap" rel="Chapter" href="CCMixmap.html">
|
|
<link title="CCRingBuffer" rel="Chapter" href="CCRingBuffer.html">
|
|
<link title="CCIntMap" rel="Chapter" href="CCIntMap.html">
|
|
<link title="CCPersistentArray" rel="Chapter" href="CCPersistentArray.html">
|
|
<link title="CCMixset" rel="Chapter" href="CCMixset.html">
|
|
<link title="CCGraph" rel="Chapter" href="CCGraph.html">
|
|
<link title="CCHashSet" rel="Chapter" href="CCHashSet.html">
|
|
<link title="CCBitField" rel="Chapter" href="CCBitField.html">
|
|
<link title="CCHashTrie" rel="Chapter" href="CCHashTrie.html">
|
|
<link title="CCWBTree" rel="Chapter" href="CCWBTree.html">
|
|
<link title="CCRAL" rel="Chapter" href="CCRAL.html">
|
|
<link title="CCImmutArray" rel="Chapter" href="CCImmutArray.html">
|
|
<link title="CCHet" rel="Chapter" href="CCHet.html">
|
|
<link title="CCZipper" rel="Chapter" href="CCZipper.html">
|
|
<link title="CCPool" rel="Chapter" href="CCPool.html">
|
|
<link title="CCLock" rel="Chapter" href="CCLock.html">
|
|
<link title="CCSemaphore" rel="Chapter" href="CCSemaphore.html">
|
|
<link title="CCThread" rel="Chapter" href="CCThread.html">
|
|
<link title="CCBlockingQueue" rel="Chapter" href="CCBlockingQueue.html">
|
|
<link title="CCTimer" rel="Chapter" href="CCTimer.html">
|
|
<link title="CCUnix" rel="Chapter" href="CCUnix.html">
|
|
<link title="CCSexp" rel="Chapter" href="CCSexp.html">
|
|
<link title="CCSexp_lex" rel="Chapter" href="CCSexp_lex.html"><title>Containers doc : CCZipper</title>
|
|
</head>
|
|
<body>
|
|
<div class="navbar"><a class="pre" href="CCHet.html" title="CCHet">Previous</a>
|
|
<a class="up" href="index.html" title="Index">Up</a>
|
|
<a class="post" href="CCPool.html" title="CCPool">Next</a>
|
|
</div>
|
|
<h1>Module <a href="type_CCZipper.html">CCZipper</a></h1>
|
|
|
|
<pre><span class="keyword">module</span> CCZipper: <code class="code"><span class="keyword">sig</span></code> <a href="CCZipper.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info module top">
|
|
<h1 id="1_ListZipper">List Zipper</h1><br>
|
|
<b>Since</b> 1.0<br>
|
|
</div>
|
|
<hr width="100%">
|
|
|
|
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">'a</code> t</span> = <code class="type">'a list * 'a list</code> </pre>
|
|
<div class="info ">
|
|
The pair <code class="code">l, r</code> represents the list <code class="code"><span class="constructor">List</span>.rev_append l r</code>, but
|
|
with the focus on <code class="code">r</code>.<br>
|
|
</div>
|
|
|
|
|
|
<pre><span id="VALempty"><span class="keyword">val</span> empty</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Empty zipper<br>
|
|
</div>
|
|
|
|
<pre><span id="VALis_empty"><span class="keyword">val</span> is_empty</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
|
|
Empty zipper? Returns true iff the two lists are empty.<br>
|
|
</div>
|
|
|
|
<pre><span id="VALto_list"><span class="keyword">val</span> to_list</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a> -> 'a list</code></pre><div class="info ">
|
|
Convert the zipper back to a list.
|
|
<code class="code">to_list (l,r)</code> is <code class="code"><span class="constructor">List</span>.rev_append l r</code><br>
|
|
</div>
|
|
|
|
<pre><span id="VALto_rev_list"><span class="keyword">val</span> to_rev_list</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a> -> 'a list</code></pre><div class="info ">
|
|
Convert the zipper back to a <i>reversed</i> list.
|
|
In other words, <code class="code">to_list (l,r)</code> is <code class="code"><span class="constructor">List</span>.rev_append r l</code><br>
|
|
</div>
|
|
|
|
<pre><span id="VALmake"><span class="keyword">val</span> make</span> : <code class="type">'a list -> 'a <a href="CCZipper.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Create a zipper pointing at the first element of the list<br>
|
|
</div>
|
|
|
|
<pre><span id="VALleft"><span class="keyword">val</span> left</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a> -> 'a <a href="CCZipper.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Go to the left, or do nothing if the zipper is already at leftmost pos<br>
|
|
</div>
|
|
|
|
<pre><span id="VALleft_exn"><span class="keyword">val</span> left_exn</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a> -> 'a <a href="CCZipper.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Go to the left, or<br>
|
|
<b>Raises</b> <code>Invalid_argument</code> if the zipper is already at leftmost pos<br>
|
|
</div>
|
|
|
|
<pre><span id="VALright"><span class="keyword">val</span> right</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a> -> 'a <a href="CCZipper.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Go to the right, or do nothing if the zipper is already at rightmost pos<br>
|
|
</div>
|
|
|
|
<pre><span id="VALright_exn"><span class="keyword">val</span> right_exn</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a> -> 'a <a href="CCZipper.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Go to the right, or<br>
|
|
<b>Raises</b> <code>Invalid_argument</code> if the zipper is already at rightmost pos<br>
|
|
</div>
|
|
|
|
<pre><span id="VALmodify"><span class="keyword">val</span> modify</span> : <code class="type">('a option -> 'a option) -> 'a <a href="CCZipper.html#TYPEt">t</a> -> 'a <a href="CCZipper.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Modify the current element, if any, by returning a new element, or
|
|
returning <code class="code"><span class="constructor">None</span></code> if the element is to be deleted<br>
|
|
</div>
|
|
|
|
<pre><span id="VALinsert"><span class="keyword">val</span> insert</span> : <code class="type">'a -> 'a <a href="CCZipper.html#TYPEt">t</a> -> 'a <a href="CCZipper.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Insert an element at the current position. If an element was focused,
|
|
<code class="code">insert x l</code> adds <code class="code">x</code> just before it, and focuses on <code class="code">x</code><br>
|
|
</div>
|
|
|
|
<pre><span id="VALremove"><span class="keyword">val</span> remove</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a> -> 'a <a href="CCZipper.html#TYPEt">t</a></code></pre><div class="info ">
|
|
<code class="code">remove l</code> removes the current element, if any.<br>
|
|
</div>
|
|
|
|
<pre><span id="VALis_focused"><span class="keyword">val</span> is_focused</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
|
|
Is the zipper focused on some element? That is, will <a href="CCZipper.html#VALfocused"><code class="code"><span class="constructor">CCZipper</span>.focused</code></a>
|
|
return a <code class="code"><span class="constructor">Some</span> v</code>?<br>
|
|
</div>
|
|
|
|
<pre><span id="VALfocused"><span class="keyword">val</span> focused</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a> -> 'a option</code></pre><div class="info ">
|
|
Returns the focused element, if any. <code class="code">focused zip = <span class="constructor">Some</span> _</code> iff
|
|
<code class="code">empty zip = <span class="keyword">false</span></code><br>
|
|
</div>
|
|
|
|
<pre><span id="VALfocused_exn"><span class="keyword">val</span> focused_exn</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a> -> 'a</code></pre><div class="info ">
|
|
Returns the focused element, or<br>
|
|
<b>Raises</b> <code>Not_found</code> if the zipper is at an end<br>
|
|
</div>
|
|
|
|
<pre><span id="VALdrop_before"><span class="keyword">val</span> drop_before</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a> -> 'a <a href="CCZipper.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Drop every element on the "left" (calling <a href="CCZipper.html#VALleft"><code class="code"><span class="constructor">CCZipper</span>.left</code></a> then will do nothing).<br>
|
|
</div>
|
|
|
|
<pre><span id="VALdrop_after"><span class="keyword">val</span> drop_after</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a> -> 'a <a href="CCZipper.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Drop every element on the "right" (calling <a href="CCZipper.html#VALright"><code class="code"><span class="constructor">CCZipper</span>.right</code></a> then will do nothing),
|
|
keeping the focused element, if any.<br>
|
|
</div>
|
|
|
|
<pre><span id="VALdrop_after_and_focused"><span class="keyword">val</span> drop_after_and_focused</span> : <code class="type">'a <a href="CCZipper.html#TYPEt">t</a> -> 'a <a href="CCZipper.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Drop every element on the "right" (calling <a href="CCZipper.html#VALright"><code class="code"><span class="constructor">CCZipper</span>.right</code></a> then will do nothing),
|
|
<i>including</i> the focused element if it is present.<br>
|
|
</div>
|
|
</body></html> |