mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
2 lines
No EOL
4 KiB
HTML
2 lines
No EOL
4 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Ref (containers.CCList.Ref)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.2"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../../index.html">containers</a> » <a href="../index.html">CCList</a> » Ref</nav><h1>Module <code>CCList.Ref</code></h1></header><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> <span>'a t</span></code><code> = <span><span><span class="type-var">'a</span> list</span> Stdlib.ref</span></code></dt></dl><dl><dt class="spec value" id="val-push"><a href="#val-push" class="anchor"></a><code><span class="keyword">val</span> push : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>-></span> <span class="type-var">'a</span> <span>-></span> unit</code></dt><dd><p><code>push rlist e</code> adds an element <code>e</code> at the head of <code>rlist</code>.</p></dd></dl><dl><dt class="spec value" id="val-pop"><a href="#val-pop" class="anchor"></a><code><span class="keyword">val</span> pop : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>-></span> <span><span class="type-var">'a</span> option</span></code></dt><dd><p><code>pop rlist</code> removes and returns <code>Some e</code> (the first element of <code>rlist</code>) or <code>None</code> if the <code>rlist</code> is empty</p></dd></dl><dl><dt class="spec value" id="val-pop_exn"><a href="#val-pop_exn" class="anchor"></a><code><span class="keyword">val</span> pop_exn : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>-></span> <span class="type-var">'a</span></code></dt><dd><p><code>pop_exn rlist</code> removes and returns the first element of <code>rlist</code>. Unsafe version of <a href="index.html#val-pop"><code>pop</code></a>.</p><dl><dt>raises Failure</dt><dd><p>if the list is empty.</p></dd></dl></dd></dl><dl><dt class="spec value" id="val-create"><a href="#val-create" class="anchor"></a><code><span class="keyword">val</span> create : unit <span>-></span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dd><p><code>create ()</code> creates a new empty reference list.</p></dd></dl><dl><dt class="spec value" id="val-clear"><a href="#val-clear" class="anchor"></a><code><span class="keyword">val</span> clear : <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>-></span> unit</code></dt><dd><p><code>clear rlist</code> removes all elements of <code>rlist</code>.</p></dd></dl><dl><dt class="spec value" id="val-lift"><a href="#val-lift" class="anchor"></a><code><span class="keyword">val</span> lift : <span>(<span><span class="type-var">'a</span> list</span> <span>-></span> <span class="type-var">'b</span>)</span> <span>-></span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>-></span> <span class="type-var">'b</span></code></dt><dd><p><code>lift f rlist</code> applies a list function <code>f</code> to the content of <code>rlist</code>.</p></dd></dl><dl><dt class="spec value" id="val-push_list"><a href="#val-push_list" class="anchor"></a><code><span class="keyword">val</span> push_list : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>-></span> <span><span class="type-var">'a</span> list</span> <span>-></span> unit</code></dt><dd><p><code>push_list rlist l</code> adds elements of the list <code>l</code> at the beginning of the list ref <code>rlist</code>. Elements at the end of the list <code>l</code> will be at the beginning of the list ref <code>rlist</code>.</p></dd></dl></div></body></html> |