Skip to content
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/functional-programming.html
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ <h3>Creating the Board</h3>
<span class="tok-mi">10</span> <span class="tok-p">{</span><span class="tok-ss">:connections</span> <span class="tok-p">{</span><span class="tok-mi">3</span> <span class="tok-mi">6</span><span class="tok-p">}}}</span>
</code></pre></div></div>

<p class="Body"><span>In the first example, </span><code>connect-down-left</code><span> takes an empty board with a max position of 15 and returns a new board populated with the mutual connection between the 1 position and the position below and to the left of it. </span><code>connect</code><code>-down-right</code><span> does something similar, returning a board populated with the mutual connection between 3 and the position below it and to its right.</span></p>
<p class="Body"><span>In the first example, </span><code>connect-down-left</code><span> takes an empty board with a max position of 15 and returns a new board populated with the mutual connection between the 1 position and the position below and to the left of it. </span><code>connect-down-right</code><span> does something similar, returning a board populated with the mutual connection between 3 and the position below it and to its right.</span></p>
<p class="Body">The next function, <code>add-pos</code>, is interesting because it actually reduces on a vector of <em>functions</em>, applying each in turn to build up the resulting board. But first it updates the board to indicate that a peg is in the given position:</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">add-pos</span>
<span class="tok-s">"Pegs the position and performs connections"</span>
Expand Down