Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"symmetrize -body-parts" to "symmetrize-body-parts" #196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/cftbat/do-things.html
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ <h3>Better Symmetrizer with reduce</h3>
</code></pre></div></div>

<p class="Body">If you provide an initial value, <code>reduce</code> starts by applying the given function to the initial value and the first element of the sequence rather than the first two elements of the sequence.</p>
<p class="Body">One detail to note is that, in these examples, <code>reduce</code> takes a collection of elements, <code>[1 2 3 4]</code>, and returns a single number. Although programmers often use <code>reduce</code> this way, you can also use <code>reduce</code> to return an even larger collection than the one you started with, as we’re trying to do with <code>symmetrize</code><code>-body-parts</code>. <code>reduce</code> abstracts the task “process a collection and build a result,” which is agnostic about the type of result returned. To further understand how <code>reduce</code> works, here’s one way that you could implement it:</p>
<p class="Body">One detail to note is that, in these examples, <code>reduce</code> takes a collection of elements, <code>[1 2 3 4]</code>, and returns a single number. Although programmers often use <code>reduce</code> this way, you can also use <code>reduce</code> to return an even larger collection than the one you started with, as we’re trying to do with <code>symmetrize-body-parts</code>. <code>reduce</code> abstracts the task “process a collection and build a result,” which is agnostic about the type of result returned. To further understand how <code>reduce</code> works, here’s one way that you could implement it:</p>
<div class="listingblock"><div class="content"><pre class="pygments highlight"><code data-lang="clojure" class="block"><span class="tok-p">(</span><span class="tok-kd">defn </span><span class="tok-nv">my-reduce</span>
<span class="tok-p">([</span><span class="tok-nv">f</span> <span class="tok-nv">initial</span> <span class="tok-nv">coll</span><span class="tok-p">]</span>
<span class="tok-p">(</span><span class="tok-k">loop </span><span class="tok-p">[</span><span class="tok-nv">result</span> <span class="tok-nv">initial</span>
Expand Down