forked from boostorg/fusion
adds documentation for functional module
[SVN r36959]
This commit is contained in:
@ -3,12 +3,12 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Algorithms</title>
|
||||
<link rel="stylesheet" href="../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
|
||||
<link rel="start" href="../index.html" title="Chapter<65>1.<2E>Fusion 2.0">
|
||||
<link rel="up" href="../index.html" title="Chapter<65>1.<2E>Fusion 2.0">
|
||||
<link rel="prev" href="sequences/operators/comparison/greater_than_equal.html" title="greater
|
||||
than equal">
|
||||
<link rel="next" href="algorithms/concepts.html" title="Concepts">
|
||||
<link rel="next" href="algorithms/iteration.html" title="Iteration">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
@ -21,33 +21,100 @@
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="sequences/operators/comparison/greater_than_equal.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="algorithms/concepts.html"><img src="../images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="sequences/operators/comparison/greater_than_equal.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="algorithms/iteration.html"><img src="../images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="fusion.algorithms"></a><a href="algorithms.html" title="Algorithms">Algorithms</a></h2></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="algorithms/concepts.html">Concepts</a></span></dt>
|
||||
<dd><dl><dt><span class="section"><a href="algorithms/concepts/poly.html"> Polymorphic Function
|
||||
Object</a></span></dt></dl></dd>
|
||||
<dt><span class="section"><a href="algorithms/iteration.html">Iteration</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="algorithms/iteration/functions.html">Functions</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="algorithms/iteration/functions/fold.html">fold</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/iteration/functions/accumulate.html">accumulate</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/iteration/functions/for_each.html">for_each</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="algorithms/iteration/metafunctions.html">Metafunctions</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="algorithms/iteration/metafunctions/fold.html">fold</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/iteration/metafunctions/accumulate.html">accumulate</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/iteration/metafunctions/for_each.html">for_each</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="algorithms/query.html">Query</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="algorithms/query/functions.html">Functions</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="algorithms/query/functions/any.html">any</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/query/functions/all.html">all</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/query/functions/none.html">none</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/query/functions/find.html">find</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/query/functions/find_if.html">find_if</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/query/functions/count.html">count</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/query/functions/count_if.html">count_if</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="algorithms/query/metafunctions.html">Metafunctions</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="algorithms/query/metafunctions/any.html">any</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/query/metafunctions/all.html">all</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/query/metafunctions/none.html">none</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/query/metafunctions/find.html">find</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/query/metafunctions/find_if.html">find_if</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/query/metafunctions/count.html">count</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/query/metafunctions/count_if.html">count_if</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="algorithms/transformation.html">Transformation</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions.html">Functions</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/filter.html">filter</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/filter_if.html">filter_if</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/transform.html">transform</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/replace.html">replace</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/replace_if.html">replace_if</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/remove.html">remove</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/remove_if.html">remove_if</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/reverse.html">reverse</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/clear.html">clear</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/erase.html">erase</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/erase_key.html">erase_key</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/insert.html">insert</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/insert_range.html">insert_range</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/join.html">join</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/zip.html">zip</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/pop_back.html">pop_back</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/pop_front.html">pop_front</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/push_back.html">push_back</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/functions/push_front.html">push_front</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions.html">Metafunctions</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/filter.html">filter</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/filter_if.html">filter_if</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/transform.html">transform</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/replace.html">replace</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/replace_if.html">replace_if</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/remove.html">remove</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/remove_if.html">remove_if</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/reverse.html">reverse</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/clear.html">clear</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/erase.html">erase</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/erase_key.html">erase_key</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/insert.html">insert</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/insert_range.html">insert_range</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/join.html">join</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/zip.html">zip</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/pop_back.html">pop_back</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/pop_front.html">pop_front</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/push_back.html">push_back</a></span></dt>
|
||||
<dt><span class="section"><a href="algorithms/transformation/metafunctions/push_front.html">push_front</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl></dd>
|
||||
</dl></div>
|
||||
<a name="fusion.algorithms.lazy_evaluation"></a><h3>
|
||||
<a name="id552698"></a>
|
||||
<a name="id1080217"></a>
|
||||
<a href="algorithms.html#fusion.algorithms.lazy_evaluation">Lazy Evaluation</a>
|
||||
</h3>
|
||||
<p>
|
||||
@ -61,39 +128,39 @@
|
||||
fusion algorithms are functional in nature such that algorithms are non mutating
|
||||
(no side effects). However, due to the high cost of returning full sequences
|
||||
such as vectors and lists, <span class="emphasis"><em>Views</em></span> are returned from Fusion
|
||||
algorithms instead. For example, the <a href="algorithms/transformation/functions/transform.html" title="transform"><tt class="computeroutput"><span class="identifier">transform</span></tt></a> algorithm does not actually
|
||||
return a transformed version of the original sequence. <a href="algorithms/transformation/functions/transform.html" title="transform"><tt class="computeroutput"><span class="identifier">transform</span></tt></a> returns a <a href="sequences/views/transform_view.html" title="transform_view"><tt class="computeroutput"><span class="identifier">transform_view</span></tt></a>. This view holds a
|
||||
algorithms instead. For example, the <a href="algorithms/transformation/functions/transform.html" title="transform"><code class="computeroutput"><span class="identifier">transform</span></code></a> algorithm does not actually
|
||||
return a transformed version of the original sequence. <a href="algorithms/transformation/functions/transform.html" title="transform"><code class="computeroutput"><span class="identifier">transform</span></code></a> returns a <a href="sequences/views/transform_view.html" title="transform_view"><code class="computeroutput"><span class="identifier">transform_view</span></code></a>. This view holds a
|
||||
reference to the original sequence plus the transform function. Iteration over
|
||||
the <a href="sequences/views/transform_view.html" title="transform_view"><tt class="computeroutput"><span class="identifier">transform_view</span></tt></a>
|
||||
the <a href="sequences/views/transform_view.html" title="transform_view"><code class="computeroutput"><span class="identifier">transform_view</span></code></a>
|
||||
will apply the transform function over the sequence elements on demand. This
|
||||
<span class="emphasis"><em>lazy</em></span> evaluation scheme allows us to chain as many algorithms
|
||||
as we want without incurring a high runtime penalty.
|
||||
</p>
|
||||
<a name="fusion.algorithms.sequence_extension"></a><h3>
|
||||
<a name="id552838"></a>
|
||||
<a name="id1080344"></a>
|
||||
<a href="algorithms.html#fusion.algorithms.sequence_extension">Sequence Extension</a>
|
||||
</h3>
|
||||
<p>
|
||||
The <span class="emphasis"><em>lazy</em></span> evaluation scheme where <a href="algorithms.html" title="Algorithms">Algorithms</a>
|
||||
return <a href="sequences/views.html" title="Views">Views</a> also allows operations
|
||||
such as <a href="algorithms/transformation/functions/push_back.html" title="push_back"><tt class="computeroutput"><span class="identifier">push_back</span></tt></a> to be totally generic. In
|
||||
Fusion, <a href="algorithms/transformation/functions/push_back.html" title="push_back"><tt class="computeroutput"><span class="identifier">push_back</span></tt></a> is actually a generic algorithm
|
||||
that works on all sequences. Given an input sequence <tt class="computeroutput"><span class="identifier">s</span></tt>
|
||||
and a value <tt class="computeroutput"><span class="identifier">x</span></tt>, Fusion's <a href="algorithms/transformation/functions/push_back.html" title="push_back"><tt class="computeroutput"><span class="identifier">push_back</span></tt></a> algorithm simply returns
|
||||
a <a href="sequences/views/joint_view.html" title="joint_view"><tt class="computeroutput"><span class="identifier">joint_view</span></tt></a>:
|
||||
a view that holds a reference to the original sequence <tt class="computeroutput"><span class="identifier">s</span></tt>
|
||||
and the value <tt class="computeroutput"><span class="identifier">x</span></tt>. Functions
|
||||
such as <a href="algorithms/transformation/functions/push_back.html" title="push_back"><code class="computeroutput"><span class="identifier">push_back</span></code></a> to be totally generic. In
|
||||
Fusion, <a href="algorithms/transformation/functions/push_back.html" title="push_back"><code class="computeroutput"><span class="identifier">push_back</span></code></a> is actually a generic algorithm
|
||||
that works on all sequences. Given an input sequence <code class="computeroutput"><span class="identifier">s</span></code>
|
||||
and a value <code class="computeroutput"><span class="identifier">x</span></code>, Fusion's <a href="algorithms/transformation/functions/push_back.html" title="push_back"><code class="computeroutput"><span class="identifier">push_back</span></code></a> algorithm simply returns
|
||||
a <a href="sequences/views/joint_view.html" title="joint_view"><code class="computeroutput"><span class="identifier">joint_view</span></code></a>:
|
||||
a view that holds a reference to the original sequence <code class="computeroutput"><span class="identifier">s</span></code>
|
||||
and the value <code class="computeroutput"><span class="identifier">x</span></code>. Functions
|
||||
that were once sequence specific and need to be implemented N times over N
|
||||
different sequences are now implemented only once. That is to say that Fusion
|
||||
sequences are cheaply extensible. However, an important caveat is that the
|
||||
result of a sequence extending operation like <a href="algorithms/transformation/functions/push_back.html" title="push_back"><tt class="computeroutput"><span class="identifier">push_back</span></tt></a> does not retain the properties
|
||||
result of a sequence extending operation like <a href="algorithms/transformation/functions/push_back.html" title="push_back"><code class="computeroutput"><span class="identifier">push_back</span></code></a> does not retain the properties
|
||||
of the original sequence such as associativity of <span class="underline">_set</span>_s.
|
||||
To regain the original sequence, <a href="sequences/conversion/functions.html" title="Functions">Conversion</a>
|
||||
functions are provided. You may use one of the <a href="sequences/conversion/functions.html" title="Functions">Conversion</a>
|
||||
functions to convert back to the original sequence type.
|
||||
</p>
|
||||
<a name="fusion.algorithms.header"></a><h3>
|
||||
<a name="id553049"></a>
|
||||
<a name="id1080532"></a>
|
||||
<a href="algorithms.html#fusion.algorithms.header">Header</a>
|
||||
</h3>
|
||||
<pre class="programlisting">
|
||||
@ -106,7 +173,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="sequences/operators/comparison/greater_than_equal.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="algorithms/concepts.html"><img src="../images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="sequences/operators/comparison/greater_than_equal.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="algorithms/iteration.html"><img src="../images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user