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, <spanclass="emphasis"><em>Views</em></span> are returned from Fusion
algorithms instead. For example, the <ahref="algorithms/transformation/functions/transform.html"title="transform"><ttclass="computeroutput"><spanclass="identifier">transform</span></tt></a> algorithm does not actually
return a transformed version of the original sequence. <ahref="algorithms/transformation/functions/transform.html"title="transform"><ttclass="computeroutput"><spanclass="identifier">transform</span></tt></a> returns a <ahref="sequences/views/transform_view.html"title="transform_view"><ttclass="computeroutput"><spanclass="identifier">transform_view</span></tt></a>. This view holds a
reference to the original sequence plus the transform function. Iteration over
the <ahref="sequences/views/transform_view.html"title="transform_view"><ttclass="computeroutput"><spanclass="identifier">transform_view</span></tt></a>
will apply the transform function over the sequence elements on demand. This
<spanclass="emphasis"><em>lazy</em></span> evaluation scheme allows us to chain as many algorithms
as we want without incurring a high runtime penalty.
The <spanclass="emphasis"><em>lazy</em></span> evaluation scheme where <ahref="algorithms.html"title="Algorithms">Algorithms</a>
return <ahref="sequences/views.html"title="Views">Views</a> also allows operations
such as <ahref="algorithms/transformation/functions/push_back.html"title="push_back"><ttclass="computeroutput"><spanclass="identifier">push_back</span></tt></a> to be totally generic. In
Fusion, <ahref="algorithms/transformation/functions/push_back.html"title="push_back"><ttclass="computeroutput"><spanclass="identifier">push_back</span></tt></a> is actually a generic algorithm
that works on all sequences. Given an input sequence <ttclass="computeroutput"><spanclass="identifier">s</span></tt>
and a value <ttclass="computeroutput"><spanclass="identifier">x</span></tt>, Fusion's <ahref="algorithms/transformation/functions/push_back.html"title="push_back"><ttclass="computeroutput"><spanclass="identifier">push_back</span></tt></a> algorithm simply returns
a <ahref="sequences/views/joint_view.html"title="joint_view"><ttclass="computeroutput"><spanclass="identifier">joint_view</span></tt></a>:
a view that holds a reference to the original sequence <ttclass="computeroutput"><spanclass="identifier">s</span></tt>
and the value <ttclass="computeroutput"><spanclass="identifier">x</span></tt>. 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 <ahref="algorithms/transformation/functions/push_back.html"title="push_back"><ttclass="computeroutput"><spanclass="identifier">push_back</span></tt></a> does not retain the properties
of the original sequence such as associativity of <spanclass="underline">_set</span>_s.
To regain the original sequence, <ahref="sequences/conversion/functions.html"title="Functions">Conversion</a>
functions are provided. You may use one of the <ahref="sequences/conversion/functions.html"title="Functions">Conversion</a>
functions to convert back to the original sequence type.