Skip to content

Commit

Permalink
typos
Browse files Browse the repository at this point in the history
  • Loading branch information
twopoint718 committed Sep 3, 2012
1 parent 15200cd commit 503ee01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions blog.html
Expand Up @@ -52,7 +52,7 @@ <h2 id="the-dipert-problem"><a name="2012-09-03">the dipert problem</a></h2>
<pre><code>(.) :: (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c</code></pre>
<p>This is a little pipeline, but reversed because that’s how mathematics does it. It says “the right-side function takes an <em>a</em> and gives a <em>b</em>, and the left-side function expects a <em>b</em> and gives a <em>c</em>; now you can stitch them together and have a function that <em>skips</em> the <em>b</em> and takes you right from <em>a</em> to <em>c</em>.” But we have a function that looks like:</p>
<pre><code>(a -&gt; b -&gt; c)</code></pre>
<p>on the right-hand side; it won’t work. how to we convert a <code>(a -&gt; b -&gt; c)</code> to a <code>(a -&gt; (b -&gt; c))</code>? This way:</p>
<p>on the right-hand side; it won’t work. how do we convert a <code>(a -&gt; b -&gt; c)</code> to a <code>(a -&gt; (b -&gt; c))</code>? This way:</p>
<pre><code>{-
f x y = foldl1 (*) ((replicate x) y)
f x y = (foldl1 (*) . (replicate x)) y
Expand Down Expand Up @@ -81,7 +81,7 @@ <h2 id="the-dipert-problem"><a name="2012-09-03">the dipert problem</a></h2>
<pre><code>(foldl1 (*) .) . replicate :: Int -&gt; Int -&gt; Int</code></pre>
<p>And that’s it, we have a point-free function that takes two <code>Int</code>s and returns an <code>Int</code>. And so that’s our last, and final function:</p>
<pre><code>f2 = (foldl1 (*) .) . replicate</code></pre>
<p>In general, and I don’t know a term for this, but the operation of successive function composition lets compose higher and higher arity functions together. Here’s a dumb example using my little point-free <code>succ</code> function:</p>
<p>In general, and I don’t know a term for this, but the operation of successive function composition lets us compose higher and higher arity functions together. Here’s a dumb example using my little point-free <code>succ</code> function:</p>
<pre><code>g :: Int -&gt; Int
g = (+1)
(g .) :: (a -&gt; Int) -&gt; a -&gt; Int
Expand Down
4 changes: 2 additions & 2 deletions index.html
Expand Up @@ -53,7 +53,7 @@ <h2 id="the-dipert-problem"><a name="2012-09-03">the dipert problem</a></h2>
<pre><code>(.) :: (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c</code></pre>
<p>This is a little pipeline, but reversed because that’s how mathematics does it. It says “the right-side function takes an <em>a</em> and gives a <em>b</em>, and the left-side function expects a <em>b</em> and gives a <em>c</em>; now you can stitch them together and have a function that <em>skips</em> the <em>b</em> and takes you right from <em>a</em> to <em>c</em>.” But we have a function that looks like:</p>
<pre><code>(a -&gt; b -&gt; c)</code></pre>
<p>on the right-hand side; it won’t work. how to we convert a <code>(a -&gt; b -&gt; c)</code> to a <code>(a -&gt; (b -&gt; c))</code>? This way:</p>
<p>on the right-hand side; it won’t work. how do we convert a <code>(a -&gt; b -&gt; c)</code> to a <code>(a -&gt; (b -&gt; c))</code>? This way:</p>
<pre><code>{-
f x y = foldl1 (*) ((replicate x) y)
f x y = (foldl1 (*) . (replicate x)) y
Expand Down Expand Up @@ -82,7 +82,7 @@ <h2 id="the-dipert-problem"><a name="2012-09-03">the dipert problem</a></h2>
<pre><code>(foldl1 (*) .) . replicate :: Int -&gt; Int -&gt; Int</code></pre>
<p>And that’s it, we have a point-free function that takes two <code>Int</code>s and returns an <code>Int</code>. And so that’s our last, and final function:</p>
<pre><code>f2 = (foldl1 (*) .) . replicate</code></pre>
<p>In general, and I don’t know a term for this, but the operation of successive function composition lets compose higher and higher arity functions together. Here’s a dumb example using my little point-free <code>succ</code> function:</p>
<p>In general, and I don’t know a term for this, but the operation of successive function composition lets us compose higher and higher arity functions together. Here’s a dumb example using my little point-free <code>succ</code> function:</p>
<pre><code>g :: Int -&gt; Int
g = (+1)
(g .) :: (a -&gt; Int) -&gt; a -&gt; Int
Expand Down

0 comments on commit 503ee01

Please sign in to comment.