<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Logan Emerson on Medium]]></title>
        <description><![CDATA[Stories by Logan Emerson on Medium]]></description>
        <link>https://medium.com/@logemerson?source=rss-e4183382a8d2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*GWyLsGew4TBzKpFg.</url>
            <title>Stories by Logan Emerson on Medium</title>
            <link>https://medium.com/@logemerson?source=rss-e4183382a8d2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 22:12:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@logemerson/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[UTF?]]></title>
            <link>https://medium.com/@logemerson/utf-71214cab3109?source=rss-e4183382a8d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/71214cab3109</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Logan Emerson]]></dc:creator>
            <pubDate>Tue, 05 Sep 2017 15:22:07 GMT</pubDate>
            <atom:updated>2017-09-05T15:22:07.039Z</atom:updated>
            <content:encoded><![CDATA[<p>When learning to code, one gets used to things not making since at first glance: “&amp;&amp;”, “thing.select { |thing| thing.name == ‘cool thing’ }”, etc. I’m glad for the daily practice in humility, and I’m becoming comfortable with it all. I find that I struggle much more when my <em>tools </em>display foreign (and important-looking) information; I’m interested at understanding code at a professional level, so I should know <em>a lot</em> about my text editor. Similarly, if I point at a buzzing knife-lazer-combination-looking-thing that’s approaching my mouth and ask my dental hygienist “<em>Hey, what’s this do?”, </em>and they reply with a shrug, then my confidence in their ability to not kill me in the following moments will be diminished to some degree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rkRPzXaV-wdumU6kcBMGzg.jpeg" /></figure><p>When I started using a text editor (i.e. Atom) that displayed UTF-8 in the bottom right of the display, I immediately looked up what it meant. I quickly read that it was a Unicode standard. I’ve proceeded to forget this and look it up again many times over the last few months. There are surely better resources for a complete understanding of what UTF-8 is, but this post will serve to convey what UTF-8 is in layman’s terms and to solidify my knowledge of UTF-8 such that I won’t need to look up the term again.</p><h3>ASCII</h3><p>In the 1963, ASCII (the American Standard Code for Information Interchange) established the first standard for encoding Latin characters in binary. While the first thing to pop into one’s head when they hear ASCII is something very stupid, like…</p><pre>    (  )   /\   _                 (     <br>    \ |  (  \ ( \.(               )                      _____<br>  \  \ \  `  `   ) \             (  ___                 / _   \<br> (_`    \+   . x  ( .\            \/   \____-----------/ (o)   \_<br>- .-               \+  ;          (  O                           \____<br>                          )        \_____________  `              \  /<br>(__                +- .( -&#39;.- &lt;. - _  VVVVVVV VV V\                 \/<br>(_____            ._._: &lt;_ - &lt;- _  (--  _AAAAAAA__A_/                  |<br>  .    /./.+-  . .- /  +--  - .     \______________//_              \_______<br>  (__ &#39; /x  / x _/ (                                  \___&#39;          \     /<br> , x / ( &#39;  . / .  /                                      |           \   /<br>    /  /  _/ /    +                                      /              \/<br>   &#39;  (__/                                             /                  \</pre><p>…the system that was standardized was <em>very </em>cleverly implemented. ASCII encodes 128 specified characters into seven-bit integers. Ninety-five of the encoded characters are printable: these include the digits <em>0</em> to <em>9</em>, lowercase letters <em>a</em> to <em>z</em>, uppercase letters <em>A</em> to <em>Z</em>, and punctuation symbols. In addition, the original specification also included 33 control codes for non-printing characters for obsolete Teletype machines.</p><p>The low-hanging fruit solution would have been to assign “A” the binary value of “0000001”, assign “Z” the binary value of “0011010”, then to follow with the assignment of the lowercase “a” to “0011011” (i.e. the very next value after “z”). This doesn’t seem like a terrible idea, but their solution was much better:</p><ul><li>A = 65 (10 0001)</li><li>a = 97 (11 0001)</li></ul><p>With this convention, ASCII was <em>fairly </em>legible.</p><h3>Encode Wars</h3><p>While ASCII was used widely among English-speaking businesses, there were still <em>many</em> encodings being used around the world. At this point in time (i.e. the 1960’s) this was not especially problematic, because fax machines were still the business communication technology of choice.</p><p>While computers are being popularized and incompatibilities between encodings are becoming more and more problematic, a trend toward 8-bit (i.e. eight binary bits per character) encoding further impedes the path toward a global encoding. Even this wasn’t <em>such</em> a big deal, because it was still rare for a company to be sending encoded information to a company using a different encoding standard.</p><p>Japan did have problems, as it had multiple encodings unto itself. When a floppy disc was walked across the street from one business to another, there was a real possibility that the information would be completely incomprehensible to the receiving business’ system. Japan has a word for this, <em>mojibake</em></p><p>Then the World Wide Web is launched, and businesses have a serious problem: the greatest tool ever invented is now available, and international businesses can’t take advantage of it, because nobody’s computers can speak with anybody else’s. In essence, everyone is now suffering from Japan’s encoding woes.</p><h3>Enter the Unicode Consortium</h3><p>Since the late 80’s, a standard has gradually formed. The goal was simple: <strong><em>every</em> script character encoded to its own number.</strong> That is, every character from Latin, Greek, Cyrillic, Armenian, Hebrew, Arabic, Syriac, Thaana, Devanagari, Bengali, Gurmukhi, Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala, Thai, Lao, Tibetan, Myanmar, Georgian, Hangul, Ethiopic, Cherokee, Canadian Aboriginal Syllabics, Khmer, Mongolian, Han (Japanese, Chinese, Korean ideographs), Hiragana, Katakana, and Yi, each associated with <em>their own</em> number.</p><p>One way to do this would have been to account for a huge number of characters and going with a 32-bit (i.e. 32 bits) system. This would have been the low-hanging fruit solution. Problems with this convention would have been:</p><ul><li>ASCII Incompatible: as the leading standard in the business world, compatibility with ASCII was desirable</li><li>Inefficient: if they began the system with “A” at 00000000000000000000000000000001, then every Latin language word document would be HUGELY wasteful, taking four times the 8-bit size in storage)</li><li>Broken: many computer systems interpret 00000000 (i.e. eight zeros in a row) as a c all to terminate a running calculation, so a 32-bit text format would suffer from irreparable backwards incompatibility</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O_6mstUKMdg-6BGGJ1h1_Q.png" /></figure><p>Very smart people have worked UTF-8 into a standard that accounts for all of these problems.</p><p>First, they began by matching ASCII. If a character can be defined by seven bits, UTF-8 leads an eight-bit code with a 0, then uses the exact ASCII.</p><p>To account for the inefficiency of 32-bit character encoding, UTF-8 is dynamic in its character storage size. For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E-sfh712r9zQSXC5MAYr8g.png" /></figure><p>This standard, which nearly works for all applications (you’ll find that antiquated characters can cause corruption in some instances), is the 8-bit Unicode Transformation Format, or UTF-8.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71214cab3109" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fractals in Programming]]></title>
            <link>https://medium.com/@logemerson/fractals-in-programming-4018af7734ab?source=rss-e4183382a8d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/4018af7734ab</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Logan Emerson]]></dc:creator>
            <pubDate>Tue, 22 Aug 2017 17:14:38 GMT</pubDate>
            <atom:updated>2017-08-22T17:14:38.174Z</atom:updated>
            <content:encoded><![CDATA[<h4>Part 1: Recursion</h4><p>I’m very new to coding. So new in fact, that I’m unable to comfortably write the surely-simply code that’s required to show an example of the title of this very post, i.e. a fractal program. I do, however, have experience with fractals in mathematics and biology, and I understand that a firm grasp of the foundational concepts of recursion, terminal units, and end conditions will prove ever-useful in the ascent toward fractal programming. As such, our journey begins with a lesson in, and a coding application of, <strong>recursion</strong>.</p><h3>What it Is</h3><p>In the third sentence of this blog, it was written:</p><blockquote>“I do… have experience with fractals in mathematics and biology…” -Logan Emerson</blockquote><p>Referencing myself in this instance seems wildly unnecessary, doesn’t it? Surely this is the embarrassing mistake that ends my blogging career. Self-reference, though tactless in writing, is key to the concept of recursion. Another example of self-reference would be in Ruby class methods:</p><pre>class Dog<br>  attr_accessor :name<br>  All = []<br>  <br>  def initialize(name)<br>    <a href="http://twitter.com/name">@name</a> = name<br>    ALL &lt;&lt; <strong>self</strong><br>  end</pre><pre>def <strong>self.all</strong><br>    ALL<br>  end<br>end</pre><p>What extends recursion beyond simple self-reference is for something to be <em>defined</em> with self-reference. The recursive definition of recursion, as provided by the <a href="https://en.oxforddictionaries.com/definition/recursion">Oxford English Dictionary</a> is “the repeated application of a <strong>recursive</strong> procedure or definition”.</p><h3>What it Do</h3><p>This definition doesn’t appear to be recursive, as the definition isn’t explicitly repetitious. However, the recursion is enacted by the self-reference.</p><p><strong>Recursion is:</strong></p><ol><li>The repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li><li>repeated application of a…</li></ol><p><em>…ad infinitum…</em></p><p>… (recursive) procedure or definition.</p><h3>What it Don’t</h3><p>As I hope I’ve made clear, a perfect recursion doesn’t end. In a later post, we’ll work with terminal units and end states to show more clearly why they exist and, much more interestingly, how they’re determined in nature.</p><p>Cool. Let’s add math.</p><h3>Numbers that Yell</h3><p><strong>Textbook</strong>: “3!”</p><p><strong>Everyone</strong>: “Chill out, three.”</p><p>The elegance of recursion shows well when considering <em>factorials. </em>In text, a factorial is a number followed by exclamation point. In grade school, a factorial is “a number times each number less than it” (e.g. 4! = 4 * 3 * 2 * 1); worth noting is that the word “each” heavily implies an <em>iterative process</em>. In big kid math, a factorial is the product of a number (an integer, specifically) <strong>and the factorial of that number less one; </strong>this, as we now know, is a recursive definition. I promise this is cool.</p><p>First, let’s talk about (and not look at) the ugly way of calculating a factorial. Using our grade school definition, a number’s factorial is <strong>the product of that number and each number less than itself. </strong>It’s awkward to say that procedure. In Ruby (did I mention this is a blog about programming?), and perhaps in other languages, one is exposed to the concepts of <em>syntactic vinegar </em>and <em>syntactic sugar</em>. <strong>Syntactic vinegar</strong> characterizes code that looks unpleasant– code that <em>must</em> be able to be written with more grace. <strong>Syntactic sugar</strong> characterizes code that makes you go</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fo8T8Gs3Ct4U5W%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fo8T8Gs3Ct4U5W%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fo8T8Gs3Ct4U5W%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="241" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4ffae933b21872ac8ecadb59fd422d5/href">https://medium.com/media/d4ffae933b21872ac8ecadb59fd422d5/href</a></iframe><p>We’ve got our choice between:</p><p><strong>Vinegar</strong>, the product of a number and each number less than itself, or</p><pre>n * (n - 1) * (n - 1) - 1 * ((n - 1) - 1) - 1…etc.</pre><p><strong>Sugar</strong>, the product of an integer and the factorial of that number less one, or</p><pre>n!</pre><p>In the shoddy visual below, the math goes down from factorial(3), then up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DvWGh4SAcw2h9PMaVDceRg.png" /><figcaption>I drew this freehand</figcaption></figure><p>First, downward:</p><ol><li>3! ( or factorial(3) )is defined as 3 * 2!,</li><li>and 2! is defined as 2 * 1!,</li><li>and 1! is equal to 1 (as is the terminal 0!, but, as a product, we can ignore the extra instance of 1).</li></ol><p>Then upward…</p><ol><li>2 * 1! (which is the definition of 2!) = 2,</li><li>so 3 * 2! (which is the definition of 3!) = 6</li></ol><p>I mentioned “elegance”, then I drew a bad picture. This branching tree representation of 4! gets some of the beauty across:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*b5vjqT1JuT4Lz7xtgeuZHg.png" /><figcaption><a href="https://i.stack.imgur.com/lz0vA.png">https://i.stack.imgur.com/lz0vA.png</a></figcaption></figure><h3>Things get Big, Things Fall Down</h3><p>As you can see in the factorial tree, things start to get big– out of hand even– fairly quickly. This out-of-hand-ness brings us toward what’s so incredible, and ultimately useful, about fractal structures, i.e. the unique ability to <em>fill space</em>. What’s more, it even constitutes its own <em>partial dimensionality</em> (e.g. 1D lines can become 1.0–1.9D lines that exhibit some area, 2D planes can become 2.0–2.9D surfaces that exhibit some volume). This sounds spooky, but we’ll get into it.</p><p>While biologically useful, this ability to indefinitely fill space can be detrimental to one’s programming causes, because programs are only shut off by instructions, and recursive functions don’t do that unless they receive instructions to do so.</p><h3>Oh God, Shut it Off</h3><p>To prevent these infinite loops, we return to end conditions. Ignoring the <em>why</em> and the math that goes with it, let’s look at the end conditions of our two factorial methods.</p><p><em>Note: the initial “if” statements in the following code block may look like end conditions, but they’re only meant to check the original input of n for its integer-ness.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*iruiPvaUS3xQ8-yyDT-uRg.jpeg" /></figure><p>Without the highlighted lines, both processes would run ad infinitum, much like our above definition of a recursion.</p><p>In math, this isn’t a big deal. A graph would get very “uppy”. However, in programming, even new programmers like you and me can overwhelm our (or any) computers’ resources with singular infinite loops.</p><h3>More Vinegar</h3><p>To successfully calculate a factorial and break the loop using an iterative method, we used <em>three</em> variables (i.e. <em>n</em>, <em>x</em>, and <em>product)</em>. Three variables for this process <em>feels </em>like way too many. I’d be willing to guess that my relative lack of programming skills failed me in my attempt to achieve this with two variables, but I’m certain that it couldn’t have been accomplished with only one variable; unless the function were to call upon itself, it would have no means to compare factors to verify the end condition:</p><pre>17 while <strong>x</strong> &lt;= n do</pre><p>cannot be translated to</p><pre>17 while (<strong>n-1)</strong> &lt;= n do</pre><p>because our iteration will never be able to terminate the process</p><pre>18 product *= n-1<br>19 (n - 1) += 1       #=&gt; n == n, so we loop again. And again.</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FdqKhnVybpzsXK%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FdqKhnVybpzsXK%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FdqKhnVybpzsXK%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="340" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc970849fae0ec6a2d68503093426483/href">https://medium.com/media/dc970849fae0ec6a2d68503093426483/href</a></iframe><h3>More Sugar</h3><p>It was, however, very easy to use only one variable, <em>n</em>, in the recursive method. The reason for this is that n redefines itself based on the “parent” n, modified by the method’s arithmetic. In this way, there are <em>generations</em> of n. Each n and its own “child” n interact to make up both factors of the product; the original elements of recursions are repurposed to continue the process of recurring in a translation of the original recursion. THIS is the syntactic sugar of recession (and thus fractals).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xqHt-FGgzOULXP9Mrj0s7Q.png" /><figcaption>Here, every “parent” branch generates two “child” branches. In the next generation, those children follow the exact pattern of their parent.</figcaption></figure><p>So we could go with</p><pre>10! = 10 * (10 - 1) * (10 - 1 - 1) * (10 - 1 - 1 - 1) * (10 - 1 - 1 - 1 - 1) * (10 - 1 - 1 - 1 - 1 - 1) * (10 - 1 - 1 - 1 - 1 - 1 - 1) * (10 - 1 - 1 - 1 - 1 - 1 - 1 - 1) * (10 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1) * (10 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1) = 3628800</pre><p>or…</p><pre>10! = 10 * 9! = 3628800</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FblqEBWV6iFjGM%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FblqEBWV6iFjGM%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FblqEBWV6iFjGM%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="290" frameborder="0" scrolling="no"><a href="https://medium.com/media/94031e07bf5f034a00276e799f1461a0/href">https://medium.com/media/94031e07bf5f034a00276e799f1461a0/href</a></iframe><h3>In Sum</h3><p>Recursion on its own may seem rather bland. The applications of recursion is where the heat is. My personal favorite application of recursion is thinking about its applications to artificial intelligence: if a machine learner is recursively self-improving, what end condition is set to exit the loop (e.g. “if returns on investment diminish beyond a certain % gain for every recursion, exit loop”). In the next post, we’ll cover the classic determinator for end conditions, the terminal unit.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4018af7734ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>