<?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 Powell on Medium]]></title>
        <description><![CDATA[Stories by Logan Powell on Medium]]></description>
        <link>https://medium.com/@loganpowell?source=rss-51406979288f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*9EpbLKmK1L1AGsoa09y8gw.png</url>
            <title>Stories by Logan Powell on Medium</title>
            <link>https://medium.com/@loganpowell?source=rss-51406979288f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 09:33:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@loganpowell/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[cljs.core.async 101]]></title>
            <link>https://medium.com/@loganpowell/cljs-core-async-101-f6522faf536d?source=rss-51406979288f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6522faf536d</guid>
            <category><![CDATA[clj]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[clojure]]></category>
            <category><![CDATA[clojurescript]]></category>
            <category><![CDATA[core-async]]></category>
            <dc:creator><![CDATA[Logan Powell]]></dc:creator>
            <pubDate>Mon, 11 Jun 2018 13:32:13 GMT</pubDate>
            <atom:updated>2022-10-31T13:24:33.347Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>There comes a time in all good programs when components or subsystems must stop communicating directly to each other.</blockquote><blockquote>Conveyance must become first class.</blockquote><blockquote>— <a href="https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/CoreAsync.md">Rich Hickey: </a><a href="https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/CoreAsync.md">core.async début</a></blockquote><h3>Dependencies</h3><pre>(ns core-async.core<br>  (:require  [cljs.core.async :refer [chan put! take! &gt;! &lt;! buffer dropping-buffer sliding-buffer timeout close! alts!]]<br>             [cljs.core.async :refer-macros [go go-loop alt!]])<br>  (:use [clojure.repl :only (source)]))</pre><h4>Canonical Post</h4><p>This is a cross-post from GitHub. If Medium’s syntax highlighting disappoints you, check out the canonical post:</p><p><a href="https://github.com/loganpowell/cljs-guides/blob/master/src/guides/core-async-basics.md">loganpowell/cljs-guides</a></p><h4>Code Example Repo:</h4><p>You can find all the code for the working examples in <a href="https://github.com/loganpowell/cljs-guides/blob/master/src/core-async/core.cljs">this repo</a>.</p><h3>Introduction</h3><p>Channels are the backbone of core.async. As in Clojure(Script), immutable data collections are the backbone, channels can be thought of as a special kind of data collection. A channel is similar in some ways to a vector (or an array in JavaScript). Like vectors, channels are collections that take values from one end (upstream) and discharge them from the other (downstream). This is also known as &quot;first in, first out&quot; processing. However, unlike vectors (or arrays), channels <em>only convey one value at a time</em> (asynchronous).</p><p>In my mind, I see a vector as a two-dimensional box, whose contents (existing synchronously) stretch the box along its x-axis. Whereas, a queue (channel), its a three-dimensional box with new values stretching the box along the z-axis (asynchronously over time). However, unlike vectors, core.async channels can not only contain values within its &quot;box&quot;, they can make operations seeking to put to or take from the channel wait in a line - outside the box in a queue - along that z-axis without the developer having to use callbacks to line them up! This provides a huge convenience for asynchronous programming. As we&#39;ll see in the following examples, these features of core.async abstract away the complexity of callbacks, allowing you to write asynchronous programs in a blissfully synchronous fashion.</p><p>Don’t get me wrong. This bliss comes at a cost. There’s a non-trivial learning curve involved. But I hope, after going through — and importantly running — the examples herein, you’ll have the fundamentals to prepare you and get you excited to use them.</p><p>core.asyc outperforms other async vehicles in a number of ways, but here are just a few highlights:</p><ul><li>Write asynchronous code as if it was synchronous</li><li>They’re <a href="http://swannodette.github.io/2013/08/23/make-no-promises">faster than Promises</a> .</li><li>Processes are first class: you can use core.async channels not only to pass data/values around but pass also channels! This feature enables you to take processes and de/compose them to do incredibly sophisticated things in just a few lines of code.</li><li>Treat channel i/o data as you would <em>any other</em> collection in ClojureScript. Enabling you to learn one set of operations (e.g., map, filter, etc... using <a href="https://blog.venanti.us/using-transducers-with-core-async-clojurescript/">transducers</a>) to rule them all!</li></ul><p>This last selling point was really the clincher for me. The idea of learning one set of operations that could be used across all my code, both asynchronous and synchronous, in a way that would improve my skills with the <em>language</em> (not just the library) seems more efficient IMHO.</p><p>Also, if you’re coming to the light via JavaScript, have a read of these two articles from the great <a href="https://twitter.com/puppybits">Bobby Schultz</a>:</p><ul><li><a href="https://medium.com/@puppybits/react-without-flux-a76236d1e1d">ReactJS with CSP &amp; core.async</a></li><li><a href="https://medium.com/@puppybits/rxjs-is-great-so-why-have-i-moved-on-534c513e7af3">RxJS is great. So why have I moved on?</a></li></ul><h3>Differences in core.async between Clojure and ClojureScript</h3><p>There are a few differences between the features of core.async in Clojure and ClojureScript as a matter of necessity. Though Clojure has threads, Node/JavaScript only has a single thread, so any thread-blocking operation will not - by default - be available in ClojureScript&#39;s implementation.</p><p>Very roughly speaking — anything that has “blocking” semantics in clojure.core.async (e.g., anything with two !!s) will not be available in cljs.core.async. Don&#39;t worry, it&#39;s still magical on the JavaScript VM. You&#39;ll see!</p><p>Enough talk. Let’s start.</p><h3>Channel Operations Basics</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*Vwr-_G-fsDVrhgfpyC-Q9g.gif" /></figure><p>For these examples, we’ll use an analogy to help explain things. Let’s say we’re operating a sushi bar. To start, we’ll use core.async just to handle taking some orders from customers...</p><h3>One-time Async Orders on a chan with put! and take!</h3><p>Let’s take a look at a slide about the channel “Service Provider Interface” (SPI) from Rich Hickey’s <a href="https://vimeo.com/100518968">presentation</a> and its relationship with other parts of your program (SPI = service provider interface):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*2hl6V_wQx-q3B_d1.jpg" /></figure><p>We’ll start with three parts of the SPI: chan, put! and take!</p><h3>Docs:</h3><pre>(source chan)</pre><pre>(defn chan<br>  &quot;Creates a channel with an optional buffer, an optional transducer (like `(map f)`, `(filter p)` etc or a composition thereof), and an optional exception handler. If `buf-or-n` is a number, will create and use a fixed buffer of that size. If a transducer is supplied a buffer must be specified. `ex-handler` must be a fn of one argument - if an exception occurs during transformation it will be called with the thrown value as an argument, and any non-nil return value will be placed in the channel.&quot;<br>  ([] (chan nil))<br>  ([buf-or-n] (chan buf-or-n nil nil))<br>  ([buf-or-n xform] (chan buf-or-n xform nil))<br>  ([buf-or-n xform ex-handler]<br>   (let [buf-or-n (if (= buf-or-n 0)<br>                    nil<br>                    buf-or-n)]<br>     (when xform (assert buf-or-n &quot;buffer must be supplied when transducer is&quot;))<br>     (channels/chan (if (number? buf-or-n)<br>                      (buffer buf-or-n)<br>                      buf-or-n)<br>                    xform<br>                    ex-handler))))</pre><p>A core.async channel (chan) can take from 0 to 3 arguments. To start, we&#39;ll use a simple chan, which creates a bufferless channel with no value transformations or exception handlers, which forces the channel to queue up any pending put or take operations instead of allowing put operations to discharge values into the channel. This kind of channel is best used for simple transactions. Let&#39;s use the analogy of taking phone orders at our sushi bar.</p><p>Create a basic channel:</p><pre>(def bufferless-chan (chan))</pre><p>eval</p><pre>(put!<br> bufferless-chan ; channel<br> &quot;Futo Maki&quot; ; order (data)<br> #(prn (str &quot;order put? &quot; %))) ; put! callback</pre><p>put 1) =&gt;</p><pre>true</pre><p>eval:</p><pre>(put!<br> bufferless-chan<br> &quot;Vegan Spider&quot;<br> #(prn (str &quot;order put? &quot; %)))</pre><p>put 2) =&gt;</p><pre>true</pre><p>eval:</p><pre>(take!<br>  bufferless-chan<br>  #(prn (str &quot;order taken: &quot; %))) ; take! callback</pre><p>take 1) =&gt;</p><pre>&quot;order taken: Futo Maki&quot;<br>&quot;order put? true&quot;<br>nil</pre><p>take 2) =&gt;</p><pre>&quot;order taken: Vegan Spider&quot;<br>&quot;order put? true&quot;<br>nil</pre><p>take 3) =&gt;</p><pre>nil</pre><p>eval last put! function again — put 3) =&gt;</p><pre>&quot;order put? true&quot;<br>&quot;order taken: Vegan Spider&quot;<br>true</pre><p>Notice the organization of the callback logs for our orders. Let’s dig into the source for put! and take! to see what&#39;s going on here:</p><h3>Docs:</h3><pre>(source put!)</pre><pre>(defn put!<br>  &quot;Asynchronously puts a `val` into `port`, calling `fn1` (if supplied) when complete. `nil` values are not allowed. Will throw if closed. If `on-caller?` (default `true`) is `true`, and the put is immediately accepted, will call `fn1` on calling thread.  Returns `nil`.&quot;<br>  ([port val<br>     (if-let [ret (impl/put! port val fhnop)]<br>       @ret<br>       true)])<br>  ([port val fn1] (put! port val fn1 true))<br>  ([port val fn1 on-caller?<br>     (if-let [retb (impl/put! port val (fn-handler fn1))]<br>       (let [ret @retb]<br>         (if on-caller?<br>           (fn1 ret)<br>           (dispatch/run #(fn1 ret)))<br>         ret)<br>       true)]))</pre><pre>(source take!)</pre><pre>(defn take!<br> &quot;Asynchronously takes a `val` from `port`, passing to `fn1`. Will pass `nil` if closed. If `on-caller?` (default `true`) is `true`, and value is immediately available, will call `fn1` on calling thread. Returns `nil.`&quot;<br> ([port fn1] (take! port fn1 true))<br> ([port fn1 on-caller?<br>    (let [ret (impl/take! port (fn-handler fn1))]<br>      (when ret<br>        (let [val @ret]<br>          (if on-caller?<br>            (fn1 val)<br>            (dispatch/run #(fn1 val)))))<br>      nil)]))</pre><p>The same callback behavior is present in both async operations. If on-caller? (default true) is true, and value is immediately accepted (for put!) or available (for take!), will call fn1 on calling thread.</p><p>When a put! is matched with a pending take! (customer calls -&gt; cook answers phone) , the take! callback is triggered first (&quot;Thanks for calling Conveyor Sushi! May I take your order?&quot; -&gt; the order is conveyed) and nil is returned (confirming the order went through on take!). Conversely - when a take! is met with a pending put!, the put! callback is triggered first (the cook calls customer -&gt; customer answers phone &quot;Hello?&quot; -&gt; the order is conveyed) and true is returned (confirming the order went through on put!).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/0*EgnqWyVPuh76VsjB.gif" /></figure><p><strong>Only one order is conveyed at a time. Everyone else has to wait.</strong></p><p>This explains the callback behavior of our puts and takes above.</p><p>If we want to change the behavior of these callbacks, we can set the on-caller parameter to false.</p><p>Now that we know how/when these callbacks are triggered, let’s create some convenience utilities to abstract them away. We’ll use these throughout the remainder of our examples.</p><h3>Orders Utils</h3><p>Create some logging callbacks to include with our put and take operations:</p><pre>(defn take-logger [order]<br>  (prn (str &quot;order taken: &quot; order)))</pre><pre>(defn put-logger [boolean]<br>  (prn (str &quot;order put? &quot; boolean)))</pre><p>Then we’ll create shortcut put and take functions which are given a channel and the logging callback</p><pre>(defn put!-order [channel order]<br>  (put! channel order put-logger))</pre><pre>(defn take!-order [channel]<br>  (take! channel take-logger))</pre><h3>Robo Orders Overflow</h3><p>What happens if we got one of those infamous robo-dialers, just spamming away at the phone line trying to sell us timeshares? Well, with our simple chan our line would overflow.</p><pre>(def bufferless-chan (chan))</pre><pre>(defn bot-orders [channel order]<br>  (dotimes [x 1030]<br>    (put!-order channel order)))</pre><p>eval</p><pre>(bot-orders bufferless-chan &quot;Sushi!&quot;)</pre><p>=&gt;</p><pre>Error: Assert failed: No more than 1024 pending puts are allowed on a single channel. Consider using a windowed buffer. (&lt; (.-length puts) impl/MAX-QUEUE-SIZE)</pre><p>Let’s take a look at another slide about the channel anatomy from Rich Hickey’s <a href="https://vimeo.com/100518968">presentation</a>, which focuses on the inner workings of the core.async channel implementation details:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*nSOYy-KEY8qQte8u.jpg" /></figure><p>You see three little tables in there:</p><ol><li>A puts handlers&#39; queue with corresponding data</li><li>An optional buffer of data</li><li>A takes handlers&#39; queue</li></ol><p>Up until now, we’ve been using a bufferless channel, so all of our put operations have been lined up “outside” our channel — table (1) — waiting to be conveyed by takers on the other side.</p><p>The creators of core.async thought it prudent (and it seems reasonable to me) for channels to be limited in how many pending put/take operations are allowed to be queued (max = 1024 pending operations). So, how might we deal with this kind of traffic? One way is with a buffered channel.</p><h3>Buffers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*HPUP8gPbPrODiDF76m5m7w.gif" /></figure><h3>Robo Orders with a Fixed Buffer</h3><h3>Docs:</h3><pre>(source buffer)</pre><pre>(defn buffer<br>  &quot;Returns a fixed buffer of size `n`. When full, puts will block/park.&quot;<br>  [n]<br>  (buffers/fixed-buffer n))</pre><p>There are two ways to create a channel with a fixed buffer. One is by explicitly using the buffer function. The other is just to pass an integer as an argument to a basic channel like so:</p><pre>(def fixed-chan (chan 10)) ; buffer = 10 values</pre><p>eval at will:</p><pre>(bot-orders fixed-chan &quot;Sushi!&quot;)</pre><pre>;=&gt; &quot;order put? true&quot;<br>;=&gt; &quot;order put? true&quot;<br>;=&gt; &quot;order put? true&quot;<br>...7 more<br>nil</pre><p>We can see that 10 of our puts were immediately accepted by the channel (causing their callbacks to be fired immediately here), while the rest will have to wait in the puts queue for future (async) takes. We were able to do this in this specific case because we received 1030 order and had a buffer that stored 10 values, allowing those 10 puts to be handled and completed (1030 puts — 10 puts consumed by buffer = 1020 pending puts &lt; 1024 max.).</p><p>You can think of a fixed buffer like a voicemail service for our sushi orders. Or — if you prefer — an online ordering system that saves orders (in this case with a storage capacity of 10 orders). Instead of forcing all customers to wait until there’s a match on the other side, a buffer allows the first 10 orders to be stored “inside” the channel. This would allow those first 10 customers to put in their orders and get back to their lives. Those lucky bastards.</p><p>eval at will:</p><pre>(take!-order fixed-chan)</pre><p>takes 1–1020) =&gt;</p><pre>&quot;order taken: Sushi!&quot;<br>&quot;order put? true&quot;<br>nil</pre><p>take 1021) =&gt;</p><pre>&quot;order taken: Sushi!&quot;<br>nil</pre><p>Last 10 puts’ callbacks have already fired.</p><p>Now this works, but let&#39;s say we’re a franchise with orders coming in from around the world! The International House of Sushi! Sounds… terrible actually, but — for illustrative purposes let’s do it.</p><p>So we can keep track of what’s going on with the channel in the following examples, let’s create a new put!-n-order function to include an order number:</p><pre>(defn put!-n-order [channel order n]<br>  (put! channel (str &quot;#: &quot; n &quot; order: &quot; order) put-logger))</pre><pre>(defn IHOS-orders [channel order]<br>  (dotimes [x 2100] lots-o&#39;-orders<br>    (put!-n-order channel order x)))</pre><p>refresh (re-eval) our fixed-chan</p><pre>(def fixed-chan (chan 10)) ; buffer = 10 put values</pre><p>eval:</p><pre>(IHOS-orders fixed-chan &quot;Nigiri!&quot;)</pre><p>=&gt;</p><pre>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>...<br>Error: Assert failed: No more than 1024 pending puts are allowed on a single channel. Consider using a windowed buffer. (&lt; (.-length puts) impl/MAX-QUEUE-SIZE) ...</pre><p>物の哀れ What’s happened is we’ve hit the limit of pending operations to our channel minus the capacity of our buffer (2100 puts — 10 buffer = 2090 pending puts &gt; 1024 max.).</p><p>eval:</p><pre>(take!-order fixed-chan)</pre><p>=&gt;</p><pre>&quot;order taken: #: 0 order: Nigiri!&quot;<br>&quot;order put? true&quot;<br>...</pre><p>Ok, so we can get to the first 10 of the orders in the buffer and the others that didn’t overflow the pending puts queue, but — with the rest — we’re in the same tsukemono (pickle) we were before. Our charming little inbox, which may have served us fine before becoming the biggest sushi chain on the planet, is full and we get an error thrown, which may create havoc in our system.</p><p>What might we do now? One thing we could do is to use a “windowed buffer”, which will drop some of the orders. There are two types of windowed buffers: a sliding-buffer and a dropping-buffer.</p><h3>Handling Orders Deluge with a sliding-buffer (Drop Oldest Puts)</h3><h3>Docs:</h3><pre>(source sliding-buffer)</pre><pre>(defn sliding-buffer)<br>  &quot;Returns a `buffer` of size `n`. When full, puts will complete, and be buffered, but oldest elements in buffer will be dropped (not transferred).&quot;<br>  [n]<br>  (buffers/sliding-buffer n)</pre><p>“Windowed” buffers serve as contracts or policies for how you handle incoming data. These can be handy in a number of scenarios (e.g., for rate limiting). Let’s show a couple of examples of how we might use a windowed buffer. First, let’s use a sliding-buffer, which drops the oldest puts:</p><pre>(def slide-chan (chan (sliding-buffer 10))) ; buffer = 10 put values</pre><p>Warning: Big log (and I don’t mean the song by Robert Plant. That would be cool though….) ahead!</p><pre>(IHOS-orders slide-chan &quot;Sashimi&quot;)</pre><p>=&gt;</p><pre>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>... **2088 more**</pre><p>eval:</p><pre>(take!-order slide-chan)</pre><p>take 1) =&gt;</p><pre>&quot;order taken: #: 2090 order: Nigiri!&quot;<br>nil</pre><p>take 2) =&gt;</p><pre>&quot;order taken: #: 2091 order: Nigiri!&quot;<br>nil<br>...</pre><p>take 10) =&gt;</p><pre>&quot;order taken: #: 2099 order: Nigiri!&quot;<br>nil</pre><p>take 11) =&gt;</p><pre>nil</pre><p><em>Note: The reason we got 2099 instead of 2100 is due to the index starting at 0</em></p><p>Now, we don’t get that pesky error thrown, we have the last 10 orders, which were stored in the sliding-buffer, but all the other orders are thrown away. In some cases, this may be what you want. E.g., for streams of data where the latest/newest values are the important ones. Say we have a display in each of our restaurants showing the latest sushi orders, so as to give dine-in patrons that &quot;I want what they&#39;re having&quot; syndrome.</p><p>A different policy we might want to build into our incoming data source is to drop the latest data upon meeting some threshold. We can do that with a dropping-buffer.</p><h3>Handling Traffic with a dropping-buffer (Drop Latest Puts)</h3><h3>Docs:</h3><pre>(source dropping-buffer)</pre><pre>(defn dropping-buffer<br>  &quot;Returns a buffer of size `n`. When full, puts will complete but val will be dropped (no transfer).&quot;<br>  [n]<br>  (buffers/dropping-buffer n))</pre><p>Let’s create a channel with a dropping buffer:</p><pre>(def drop-chan (chan (dropping-buffer 10)))</pre><p>Then use our surge order operation on it:</p><pre>(IHOS-orders drop-chan &quot;Tofu Katsu&quot;)</pre><p>=&gt;</p><pre>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>... **2088 more**</pre><p>eval:</p><pre>(take!-order drop-chan)</pre><p>take 1) =&gt;</p><pre>&quot;order taken: #: 0 order: Tofu Katsu&quot;<br>nil</pre><p>take 2) =&gt;</p><pre>&quot;order taken: #: 1 order: Tofu Katsu&quot;<br>nil</pre><p>…</p><p>take 10) =&gt;</p><pre>&quot;order taken: #: 9 order: Tofu Katsu&quot;</pre><p>Now we are keeping the oldest data. Once our buffer is full (10 values), any remaining puts will be completed (and their callbacks fired if supplied), but only the first 10 values will be kept. The rest are dropped. When dealing with upstream (putting) data source, sometimes this behavior is useful.</p><p>For our sushi restaurant, this is like having a special bar section called “The Roulette Room” (Tagline: <em>“That’s just how we roll.”™</em>). This isn’t your run-of-the-mill bar seating room though. It’s got a glow-in-the-dark jellyfish aquarium and rotating visiting celebrity chefs from around the world, so people line up to get a spot. But there’s a catch. If the line has less than 10 people in it you can get in it, but if not, you are sent away. While you can try again later (make another put), you can’t wait (“park”) in line (that would be rude‡ to the seated guests). In our example above, all pending and future puts are dispatched as completed, but their values are dropped until room opens up in the buffer at which time new puts will be accepted.</p><p>While this works for The Roulette Room, this just won’t do for our ordering system. We don’t want to drop any orders (that would be rude‡, not to mention bad for business). So, how might we accommodate our deluge of orders without dropping any?</p><p><em>‡ There are 16 words for “rude” in Japanese</em></p><h3>Backpressure</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*DCDWm2udGdZqDqPd.gif" /></figure><h3>Burst Orders with (go) Backpressure Upstream (&gt;!) and Async Downstream (take!)</h3><blockquote>One of the ways you can take care of (not dropping puts) is to implement backpressure by using a blocking construct on the entry point.</blockquote><blockquote>— RH</blockquote><h3>Docs:</h3><pre>(source go)</pre><pre>(defmacro go<br>  &quot;Asynchronously executes the `body`, returning immediately to the calling thread. Additionally, any visible calls to `&lt;!`, `&gt;!` and `alt!/alts!` channel operations within the body will block (if necessary) by &#39;parking&#39; the calling thread rather than tying up an OS thread (or the only JS thread when in ClojureScript). Upon completion of the operation, the `body` will be resumed.</pre><pre>  Returns a channel which will receive the result of the `body` when completed&quot;<br>  [&amp; body]<br>  `(let [c# (cljs.core.async/chan 1)]<br>     (cljs.core.async.impl.dispatch/run<br>      (fn []<br>        (let [f# ~(ioc/state-machine body 1 &amp;env ioc/async-custom-terminators)<br>              state# (-&gt; (f#)<br>                         (ioc/aset-all! cljs.core.async.impl.ioc-helpers/USER-START-IDX c#))]<br>          (cljs.core.async.impl.ioc-helpers/run-state-machine-wrapped state#))))<br>     c#))</pre><p>This is <em>where</em> the magic happens. go blocks provide an environment where we can escape callback hell. As <a href="https://twitter.com/stuarthalloway?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor">Stuart Halloway</a> explains in his <a href="https://www.infoq.com/presentations/core-async">great talk</a> about core.async (paraphrasing):</p><p>go is a first-class process abstraction that will either use real threads (Java VM) or use &quot;magic-callback-hell-behind-the-scenes-threads&quot; (JavaScript VM) giving users who don&#39;t have real threads to work with (i.e., ClojureScript/JavaScript users) the ability to write code as if they did. go uses a state machine with &quot;blocking&quot;/&quot;parking&quot; to enable this.</p><p>The way we pass work done within a go block to another part of our program (or vice-versa) is through channels. and the way we put values into a channel when inside a go block is with the &quot;parking&quot; put syntax &gt;!</p><h3>Docs:</h3><pre>(source &gt;!)</pre><pre>(defn &gt;!<br>  &quot;puts a `val` into `port`. nil values are not allowed. Must be called inside a `(go ...)` block. Will park if no buffer space is available. Returns `true` unless `port` is already closed.&quot;<br>  [port val]<br>  (throw (js/Error. &quot;&gt;! used not in (go ...) block&quot;)))</pre><p>Notice that the “parking” put function (&gt;!) doesn&#39;t have a callback argument (as does put!). Since go will allow us to write our asynchronous code in a synchronous style, we won&#39;t need them. Asynchronous callback communication between functions to convey data over time are a thing of the past and you can think of data flowing through the operations to/from channels within a go block as being available synchronously. However, for illustrative purposes, we want our logs, so we have to move our put-logger outside the channel operation to get them.</p><pre>(defn backpressured-orders [channel order]<br>  (go<br>    (dotimes [x 2100] ; increase number of bot orders<br>      (put-logger (&gt;! channel (str &quot;#: &quot; x &quot; order: &quot; order))))))</pre><pre>(def burst-chan (chan 50))</pre><p>Buffers with backpressure not only allow you to handle large data feeds, but they also allow you to balance put (upstream) and take (downstream) data sources, which might flow inconsistently. For example, if our sushi chefs get the online orders only when they have time to do 50 orders (in “bursts” of 50), a fixed buffer of 50 with backpressure upstream would allow them to take their capacity and then open that buffer for the next 50 to fill up for the next run. Let’s see this in action.</p><pre>(defn burst-take! [channel]<br>  (dotimes [x 50] ; take 50 orders at a time<br>    (take!-order channel)))</pre><p>eval:</p><pre>(backpressured-orders burst-chan &quot;Umami Tamago&quot;)</pre><p>=&gt;</p><pre>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>... 48 more</pre><p>eval:</p><pre>(burst-take! burst-chan)</pre><p>take 1) =&gt;</p><pre>&quot;order taken: #: 0 order: Umami Tamago&quot;<br>...<br>&quot;order taken: #: 49 order: Umami Tamago&quot;<br>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>... 48 more</pre><p>take 2) =&gt;</p><pre>&quot;order taken: #: 50 order: Umami Tamago&quot;<br>...<br>&quot;order taken: #: 99 order: Umami Tamago&quot;<br>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>... 48 more</pre><p>As you can see, upon evaluation of backpressured-orders we get 50 orders put into the fixed buffer. Then - with each evaluation of burst-take! - we get a set of 50 takes (exhausting the buffer) and 50 more puts, which fill up the buffer again.</p><p>Also notice, that we were significantly over the queue limit on the other side of our buffer. However, we didn’t get the (MAX-QUEUE-SIZE) Error, as we did in the case, using put!.</p><p>What allowed us to queue up the remaining pending orders (after our buffer 50 filled up) — even though we’re over the 1024 allowance for pending puts — is backpressure. By wrapping our orders’ puts in a (go...) block and changing the put! to its corresponding &quot;parking&quot; syntax (&gt;!) we&#39;ve spun up a thread (in JavaScript an <a href="http://hueypetersen.com/posts/2013/08/02/the-state-machines-of-core-async/">&quot;Inversion of Control&quot; </a>state machine) that conducts some &quot;magic-callback-hell-behind-the-scenes&quot; to register and keep track of the pending puts without overflowing the channel. In effect, we are able to make put operations lazy, postponing their evaluation until there are matching takes and/or room in a buffer.</p><p>Elaboration: Backpressure prevents putting operations from getting registered to the handlers’ queue in the channel. Instead of using the channel’s puts queue, the “blocking” (go...) creates a state machine that keeps track of the state of the dotimes function (in this case) and effectively pauses it when there&#39;s no availability for puts in the channel. This allows upstream &quot;producers&quot; of data to govern their rate of production according to the capacity of the consumers downstream.</p><h3>go Block Caveats</h3><p>It’s important to note that the <a href="https://github.com/clojure/core.async/wiki/Go-Block-Best-Practices">go macro stops translating at function creation boundaries</a>. So, for example, if we were to use this code instead of our other backpressured-orders function above...</p><pre>(defn &gt;!-order [channel order count]<br>  (put-logger (&gt;! channel (str &quot;#: &quot; count &quot; order: &quot; order))))</pre><pre>(defn backpressured-orders [channel order]<br>  (go<br>    (dotimes [x 2100] ; increase number of bot orders<br>      (&gt;!-order channel order x))))</pre><p>We would get the error:</p><pre>...Error: &gt;! used not in (go ...) block ...</pre><p>Learn more in the <a href="https://github.com/clojure/core.async/wiki/Go-Block-Best-Practices">Best Practices Guide</a> by Alex Miller.</p><h3>Burst Orders with Backpressure Upstream (&gt;!) and Downstream (&lt;!)</h3><h3>Docs:</h3><pre>(source &lt;!)</pre><pre>(defn &lt;!<br>  &quot;takes a val from `port`. Must be called inside a `(go ...)` block. Will return nil if closed. Will park if nothing is available. Returns `true` unless port is already closed&quot;<br>  [port]<br>  (throw (js/Error. &quot;&lt;! used not in (go ...) block&quot;)))</pre><pre>(def burst-chan (chan 50))</pre><pre>(defn burst-&lt;! [channel]<br>  (go<br>    (dotimes [x 50]<br>      (take-logger (&lt;! channel)))))</pre><pre>(backpressured-orders burst-chan &quot;Umami Tamago&quot;)</pre><p>same as before</p><pre>(burst-&lt;! burst-chan)</pre><p>same as before</p><h3>Burst Orders with Async Upstream (put!) Downstream &quot;Parking&quot; (&lt;!)</h3><p>However, if we were to reverse the backpressure, i.e., use the asynchronous putting syntax (put!) upstream with the &quot;parking&quot; take syntax (&lt;!) downstream...</p><pre>(def burst-chan (chan 50))</pre><p>eval:</p><pre>(IHOS-orders burst-chan &quot;Miso Soup!&quot;)</pre><p>Old Faithful:</p><pre>Error: Assert failed: No more than 1024 pending puts are allowed on a single channel. Consider using a windowed buffer. (&lt; (.-length puts) impl/MAX-QUEUE-SIZE)</pre><p>eval:</p><pre>(burst-&lt;! burst-chan)</pre><p>=&gt;</p><pre>No bueno</pre><h4>Key Takeaway</h4><p>We get an immaterial difference when using “blocking” syntax both up and downstream due to the operations deluge coming from the producing side of the channel. If our consumer side (take!) was the overzealous one, this example might work. The takeaway is that backpressure should be applied on the aggressive end of the channel. If both sides are aggressive and somewhat inconsistent in their availability, you might need back pressure applied on both ends.</p><p>Now, in this case, no orders will ever be dropped. But, what if we can’t handle all those orders? We don’t want to drop orders. We also don’t want customers to place an order if there’s no hope of them ever getting filled. So, what do we do? Well, there are lots of ways we can control the behavior of our channels, but let’s start with a few fundamental control structures.</p><p>Now that we know how to handle deluges of upstream data (i.e., from puts) and have gotten acquainted with the limits of channels pending operations queues, we can reduce the number of puts and takes (and logging) to focus on controlling the qualities of behavior (rather than quantities of traffic) of our channels.</p><h3>Shutdown Orders with close!</h3><h3>Docs:</h3><pre>(source close!)</pre><pre>(defn close!<br>   &quot;Closes a channel. The channel will no longer accept any puts (they will be ignored). Data in the channel remains available for taking, until exhausted, after which takes will return nil. If there are any pending takes, they will be dispatched with nil. Closing a closed channel is a no-op. Returns nil. Logically closing happens after all puts have been delivered. Therefore, any blocked or parked puts will remain blocked/parked until a taker releases them.&quot;<br>   ([port]<br>    (impl/close! port)))</pre><p>The close! function provides a way to shut a channel down from the &quot;outside&quot;. By passing a channel into the close!function, all following puts will be rejected (returning false), but any values in a buffer will be available for taking as well as any parked or pending puts sent to the channel before close!.</p><p>Let’s first send in some puts to a channel with a small buffer of a sufficient quantity, which will convey orders into the buffer as well as queue up some pending puts for the channel.</p><pre>(defn max-order [channel order]<br>  (go<br>    (dotimes [x 12]<br>      (put-logger (&gt;! channel (str &quot;#: &quot; x &quot; order: &quot; order))))<br>    (close! channel)))</pre><pre>(def capacity (chan 5))</pre><pre>(defn take!-til-closed [channel]<br>  (dotimes [x 5]<br>    (take!-order channel)))</pre><p>eval:</p><pre>(max-order capacity &quot;Wildcard&quot;)</pre><p>=&gt;</p><pre>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>&quot;order put? true&quot;<br>&quot;order put? true&quot;</pre><p>eval:</p><pre>(take!-til-closed capacity)</pre><p>take 1) =&gt;</p><pre>&quot;order taken: #: 0 order: Wildcard&quot;<br>...<br>&quot;order put? true&quot;<br>...<br>nil</pre><p>take 2) =&gt;</p><pre>&quot;order taken: #: 5 order: Wildcard&quot;<br>...<br>&quot;order put? true&quot;<br>...<br>nil</pre><p>take 3) =&gt;</p><pre>&quot;order taken: #: 10 order: Wildcard&quot;<br>&quot;order taken: #: 11 order: Wildcard&quot;<br>&quot;order taken: &quot;<br>&quot;order taken: &quot;<br>&quot;order taken: &quot;<br>nil</pre><p>After 12 puts, we closed the channel. Thus, 5 orders went into the fixed buffer and 7 were queued up. None were lost. However, if we try to put more orders into the closed channel…</p><pre>(put! capacity &quot;Overflow&quot; put-logger)</pre><p>=&gt;</p><pre>&quot;order put? false&quot;<br>false</pre><p>This is a simple way of controlling how many orders we are prepared to handle. For a fledgling sushi bar, this might be sufficient. Let’s consider some more sophisticated ways of working with channels.</p><h3>Instituting a closing time with alts! and timeout</h3><p>One of the most important control structures in core.async: alts!</p><blockquote><em>Alt is actually the tricky operation. Almost everything that’s built into this channel implementation is there to support alt because alt is the hard part.</em></blockquote><blockquote><em>— </em><a href="https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/ImplementationDetails.md"><em>RH</em></a></blockquote><h3>Docs:</h3><pre>(source alts!)</pre><pre>(defn alts!<br>  &quot;Completes at most one of several channel operations. Must be called inside a `(go ...) block`. `ports` is a vector of channel endpoints, which can be either a channel to take from or a vector of `[channel-to-put-to val-to-put]`, in any combination. Takes will be made as if by `&lt;!`, and puts will be made as if by `&gt;!`. Unless the `:priority` option is `true`, if more than one port operation is ready a non-deterministic choice will be made. If no operation is ready and a `:default` value is supplied, `[default-val :default]` will be returned, otherwise `alts!` will park until the first operation to become ready completes. Returns `[val port]` of the completed operation, where `val` is the value taken for takes, and a boolean (`true` unless already closed, as per `put!`) for puts.</pre><pre>  Supported options: (`opts` are passed as `:key val`)</pre><pre>  `:default val` - the value to use if none of the operations are immediately ready<br>  `:priority true` - (default nil) when `true`, the operations will be tried in order.</pre><pre>  Note: there is no guarantee that the port exps or val exprs will be used, nor in what order should they be, so they should not be depended upon for side effects.&quot;</pre><pre>  [ports &amp; {:as opts}]<br>  (throw (js/Error. &quot;alts! used not in (go ...) block&quot;)))</pre><pre>(source timeout)</pre><pre>(defn timeout<br>  &quot;Returns a channel that will close after msecs&quot;<br>  [msecs]<br>  (timers/timeout msecs))</pre><p>Let’s make our example a little more interesting. Say we have three bars at each of our sushi restaurants, each taking orders in (simultaneously!) at different intervals (some are more popular than others). Let’s also say that our restaurant stops taking orders after 3000 milliseconds of operation time (“Fastest Sushi on the Planet”™).</p><pre>(defn timeout-chan [channel]<br>  (let [closer (timeout 3000)]<br>    (go (while true (&lt;! (timeout 250)) (&gt;! channel &quot;Main Bar&quot;)))<br>    (go (while true (&lt;! (timeout 500)) (&gt;! channel &quot;Online Order&quot;)))<br>    (go (while true (&lt;! (timeout 750)) (&gt;! channel &quot;Roulette Room&quot;)))<br>    (go-loop [_ []]<br>      (let [[val ch] (alts! [channel closer])] ; &lt;- `alts!`<br>        (cond<br>          (= ch closer) (do<br>                          (close! channel)<br>                          (.log js/console (str &quot;No more orders. Domo Arigatogozaimashita.&quot;)))<br>          :else<br>          (recur (.log js/console (str &quot;Order up: &quot; (&lt;! channel)))))))))</pre><pre>(def capacity (chan 5))</pre><p>eval:</p><pre>(timeout-chan capacity)</pre><p>=&gt;</p><pre>Order up: Online Order<br>Order up: Roulette Room<br>Order up: Online Order<br>Order up: Main Bar<br>Order up: Online Order<br>Order up: Main Bar<br>Order up: Main Bar<br>Order up: Main Bar<br>Order up: Main Bar<br>Order up: Roulette Room<br>No more orders. Domo Arigatogozaimashita.</pre><p>We used timeout above to terminate our process. It&#39;s important to note that while timeout does return a channel, the channel is only there to signal you when the given number of milliseconds has elapsed and it signals that by giving you a closed chan. This is one method for properly terminating a looping go: Stop it taking from or putting to the target chan by switching to a closed channel (via alts!).</p><p>But more importantly…</p><h3>We just spun up three. independent. asynchronous. processes.</h3><h3>Yeah, we just did that in three lines of code.</h3><h4><em>This is not a section. I just thought big letters were apropos.</em></h4><p>Now we can drain the pending orders from the buffer and let our cooks get to more important things… Yamazaki.</p><pre>(take! capacity take-logger)</pre><pre>;;=&gt; &quot;order taken: Online Order&quot;<br>;;=&gt; &quot;order taken: &quot;</pre><p>And we’re done!</p><p>This has been a whirlwind tour of the basics of core.async. I hope - in future articles to go in more depth and cover even more exciting things you can do with it.</p><h3>Getting Help</h3><h3>Join the Clojurian’s Slack Channel</h3><p>In the making of this guide, I leveraged the wonderful community of Clojure(Script) users on the <a href="http://clojurians.net/">Clojurians’ Slack</a>.</p><ul><li>If you’re new to Clojure(Script), I highly recommend the <a href="https://clojurians.slack.com/messages/beginners/">#beginners channel</a></li><li>If you’re new to core.async, there&#39;s a <a href="https://clojurians.slack.com/messages/core-async/">#core-async channel</a> as well!</li></ul><p>I think you’ll find the members of the community are some of the most generous people you’ll ever meet.</p><h3>Special Thanks</h3><p>Great help from these guys on the Clojurians’ Slack:</p><ul><li><a href="https://twitter.com/noisesmith">noisesmith</a></li><li><a href="https://github.com/hiredman">hiredman</a></li><li><a href="https://twitter.com/seancorfield">SeanCorfield</a></li><li><a href="https://twitter.com/brianru">BrianRubinton</a></li></ul><p><a href="https://twitter.com/swannodette">David Nolen</a> for his awesome <a href="http://swannodette.github.io/2013/07/12/communicating-sequential-processes">blog posts</a> and <a href="https://purelyfunctional.tv/programmer-profiles/david-nolen/">webinars</a> and — of course — for <a href="https://github.com/clojure/clojurescript/graphs/contributors">ClojureScript!</a></p><p><a href="https://twitter.com/timbaldridge">Timothy Baldridge</a> and <a href="https://twitter.com/puredanger">Alex Miller</a> for <a href="https://github.com/clojure/core.async/graphs/contributors">core.async</a>. Tim also has some great <a href="https://tbaldridge.pivotshare.com/home">core.async tutorials</a>!</p><h3>Additional Resources</h3><p>If you haven’t already, take a gander at the clojure.core.async (<a href="https://clojure.github.io/core.async/">API Reference</a> or <a href="https://clojuredocs.org/clojure.core.async">docs</a>) do so!</p><p>Check out this <a href="https://medium.com/@hlship/some-observations-about-clojure-core-async-dc0ad44b8e2f">blog post</a> from <a href="https://twitter.com/hlship">Howard M. Lewis</a> (the core contributor of a fantastic <a href="https://github.com/walmartlabs/lacinia/graphs/contributors">Clojure GraphQL Server</a>) covering what to think about when spinning up threads.</p><p>Implementation of core.async <a href="https://vimeo.com/100518968">Rich Hickey presentation</a></p><ul><li><a href="https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/ImplementationDetails.md">transcript and slides</a> courtesy of <a href="https://github.com/matthiasn">Matthias Nehlsen</a></li></ul><p>Presentation: <a href="https://www.youtube.com/watch?v=VrmfuuHW_6w">core.async debut</a> with Rich Hickey</p><ul><li><a href="https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/CoreAsync.md">Transcript and slides</a> courtesy of <a href="https://github.com/matthiasn">Matthias Nehlsen</a></li></ul><p>core.async: Concurrency Without Callbacks from <a href="https://www.infoq.com/presentations/core-async">Stuart Halloway</a></p><ul><li>GitHub <a href="https://github.com/cognitect/async-webinar">source for examples</a> from the talk</li></ul><p>Timeouts and Working with Multiple Channels via Parking and alts! by <a href="https://wtfleming.github.io/2015/05/27/adventures-with-core-async-part-two-parking-timeouts-alt/">Will Fleming</a>.</p><p>Other Examples from <a href="https://github.com/halgari/clojure-conj-2013-core.async-examples/blob/master/src/clojure_conj_talk/core.clj">Tim Baldridge</a>.</p><p>David Nolen <a href="https://github.com/cognitect/async-webinar/blob/master/src/webinar/core.cljs">Webinar Examples</a>.</p><p>Interview with Tim Baldridge <a href="https://www.infoq.com/interviews/baldridge-core-async">discussing </a><a href="https://www.infoq.com/interviews/baldridge-core-async">core.async</a>.</p><h3>Examples of core.async</h3><p>Check out Some Advanced Examples of core.asyncin Action in Actual Projects</p><ol><li><a href="https://github.com/mtgred/netrunner/search?q=core.async&amp;unscoped_q=core.async">NetRunner: Game</a></li><li><a href="https://github.com/jackschaedler/goya/search?q=core.async&amp;unscoped_q=core.async">Goya: Pixel Editor</a></li><li><a href="https://github.com/yuhama/wordsmith/blob/848976002c8a0830e7ee85a352530f610d112389/src/wordsmith/core.cljs">Wordsmith Markdown Editor</a></li></ol><h3>For the theorist reader:</h3><p>Read more about the concepts behind core.async: <a href="https://en.wikipedia.org/wiki/Communicating_sequential_processes">Communicating Sequential Processes: CSP</a>).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6522faf536d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clojurescript Development for JavaScript Developers in Atom with Shadow-cljs and ProtoREPL]]></title>
            <link>https://medium.com/@loganpowell/clojurescript-development-for-javascript-developers-in-atom-with-shadow-cljs-and-protorepl-ec5e38e3de26?source=rss-51406979288f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec5e38e3de26</guid>
            <category><![CDATA[clj]]></category>
            <category><![CDATA[protorepl]]></category>
            <category><![CDATA[shadow-cljs]]></category>
            <category><![CDATA[atom]]></category>
            <category><![CDATA[clojurescript]]></category>
            <dc:creator><![CDATA[Logan Powell]]></dc:creator>
            <pubDate>Thu, 24 May 2018 22:09:44 GMT</pubDate>
            <atom:updated>2018-06-02T17:56:03.171Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<h3>ClojureScript Development for JavaScript Developers in Atom with Shadow-cljs and ProtoREPL</h3><h3>Introduction</h3><p>shadow-cljs is a clojurescript development environment that integrates seamlessly with the npm ecosystem to manage JavaScript dependencies. There are also many other conveniences that <a href="https://github.com/thheller">the author</a> (and <a href="https://github.com/thheller/shadow-cljs/graphs/contributors">contributors</a> - one of which <a href="https://medium.com/@jiyinyiyong/clojurians-please-share-your-knowledges-with-blogs-c674503f54a">inspired me</a> to write this up) of shadow has provided the JavaScript-come-Clojurescript developer. Herein, we&#39;re going to run through how to get setup with shadow. This guide will focus on Atom, but there are <a href="https://shadow-cljs.github.io/docs/UsersGuide.html#_editor_integration">many other IDE/text editors</a> you can use for this.</p><h4>Caveat:</h4><p>This is going to be a whirlwind tour of shadow-cljs for JavaScript developers who use Atom. It was created in a bit of a hurry, so if you find anything confusing please highlight were you’re getting lost and I’ll follow up. If you’ll provide suggestions for improvement - they’ll be incorporated.</p><h3>Prerequisites</h3><h4>ProtoREPL in Atom</h4><p>The author of <a href="https://atom.io/packages/proto-repl">ProtoREPL</a> has put together a marvelous setup guide, which you can find <a href="https://gist.github.com/jasongilman/d1f70507bed021b48625">here</a>. While the author uses Leiningen, you can skip those steps if you’d like. However, I find that there’s very little overhead and — perhaps more importantly — just following all the steps is probably the fastest/clearest path. As a bonus, you’ll already be setup for Clojure AND Clojurescript development by just following the steps there and here.</p><h4>Java SDK:</h4><p>Both Leiningen and Shadow require a modern version of Java SDK installed. The recommended version — as of the time of writing — is version 8, which you can find <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">here</a>. Don’t worry, you won’t have to touch Java for Clojurescript. It just needs the compiler.</p><h4>Install the Shadow CLI</h4><pre>npm install -g shadow-cljs</pre><h3>Shadow-cljs Setup</h3><h4>Follow along with a working project:</h4><p><a href="https://github.com/loganpowell/shadow-proto-starter">https://github.com/loganpowell/shadow-proto-starter</a></p><h4>Local Files</h4><p>In the root directory of your project, create a shadow-cljs.edn file. At the top of shadow-cljs.edn add line:</p><pre>{:source-paths [&quot;src&quot;]}</pre><p>You can also generate a starter shadow-cljs.edn file from your terminal with shadow-cljs init.</p><p>Create a src folder in the root directory of your project. The src folder is where you&#39;ll create a user.clj file, wherein you include the short program:</p><pre>(ns user)<br> (defn reset [])</pre><p>As mentioned in <a href="https://shadow-cljs.github.io/docs/UsersGuide.html#_proto_repl_atom">the shadow docs</a>: “The file must define the user/reset fn since Proto REPL will call that when connecting. If user/reset is not found it will call tools.namespace which destroys the running shadow-cljs server. We don’t want that.”</p><p>No, we don’t want that.</p><p>Edit theshadow-cljs.edn file by adding [proto-repl &quot;0.3.1&quot;] to the :dependencies key and set the :nrepl port (using 3333 here, but you can use whatever you prefer). Find out more about dependencies <a href="https://shadow-cljs.github.io/docs/UsersGuide.html#_configuration">in the docs</a>. It should look like this:</p><pre>{:source-paths [&quot;src&quot;]<br> :dependencies [[proto-repl &quot;0.3.1&quot;]]<br> :nrepl {:port 3333}}</pre><p>Add the following scripts to your package.json file and install the necessary dependencies:</p><pre>&quot;scripts&quot;: {<br>  &quot;dev&quot;: &quot;shadow-cljs watch app&quot;,<br>  &quot;release&quot;: &quot;shadow-cljs release app&quot;<br>},<br>&quot;devDependencies&quot;: {<br>  &quot;shadow-cljs&quot;: &quot;&lt;version&gt;&quot;<br>}</pre><p>Once that’s set up, in your terminal, run: shadow-cljs server</p><p>You <em>should</em> now have the most basic shadow server up and running. In your terminal you should see:</p><pre>...<br>shadow-cljs - starting ...<br>shadow-cljs - Using IP &quot;10.0.75.1&quot; from Interface &quot;Hyper-V Virtual Ethernet Adapter #2&quot;<br>shadow-cljs - server version: 2.3.23<br>shadow-cljs - server running at http://0.0.0.0:9630<br>shadow-cljs - socket repl running at localhost:52249<br>shadow-cljs - nREPL server started on port 3333</pre><p>upon running the first time, you will have a new folder in your project: .shadow-cljs</p><h4>Atom Settings</h4><p>Now that you have your base project setup, you can get the fun part: Using the REPL!!</p><p>In Atom use your Atom Command Pallet (mine is ctrl+shift+p) and find:</p><p>Proto Repl: Remote Nrepl Connection</p><p>In the dialog that pops up leave the setting for “host”: localhost enter the :nrepl port you set in your shadow-cljs.edn file:</p><p>3333 in this case</p><h4>Kicking the Tires</h4><p>Now, just try out some Clojure(script) in the REPL that pops up. Something like:</p><pre>(+ 1 2)</pre><p>Hit shift+enter and you should see 3 in the REPL. If you got that, congrats! We&#39;re now ready for development!</p><h3>Project Deployment Targets</h3><p>There are a number of :targets <a href="https://shadow-cljs.github.io/docs/UsersGuide.html#_build_target">you can set</a> Shadow for.</p><p>Each build in shadow-cljs must define a :target which defines where you intend your code to be executed. There are default built-ins for the browser and node.js. They all share the basic concept of having :dev and :release modes. :dev mode provides all the usual development goodies like fast compilation, live code reloading and a REPL. :release mode will produce optimized output intended for production.</p><p>Targets are covered in separate chapters.</p><p>Here are some of them:</p><p><a href="https://shadow-cljs.github.io/docs/UsersGuide.html#target-browser">:browser</a> Output code suitable for running in a web browser.</p><p><a href="https://shadow-cljs.github.io/docs/UsersGuide.html#target-bootstrap">:bootstrap</a> Output code suitable for running in bootstrapped cljs environment.</p><p><a href="https://shadow-cljs.github.io/docs/UsersGuide.html#target-browser-test">:browser-test</a> Scan for tests to determine required files, and output tests suitable for running in the browser.</p><p><a href="https://shadow-cljs.github.io/docs/UsersGuide.html#target-karma">:karma</a> Scan for tests to determine required files, and output karma-runner compatible tests. See Karma.</p><p><a href="https://shadow-cljs.github.io/docs/UsersGuide.html#target-node-library">:node-library</a> Output code suitable for use as a node library.</p><p><a href="https://shadow-cljs.github.io/docs/UsersGuide.html#target-node-script">:node-script</a> Output code suitable for use as a node script.</p><p><a href="https://shadow-cljs.github.io/docs/UsersGuide.html#target-npm-module">:npm-module</a> Output code suitable for use as an NPM module.</p><p>This means that you can — with Shadow — deploy an app, a node module or a simple node script without ever leaving Shadow. Also, perhaps in the not too distant future, you may see <a href="https://github.com/shadow-cljs/expo-test">React Native</a> on the list!</p><p>We are going to cover two of these:</p><ol><li>Web Application</li><li>Node Library</li></ol><h3>1) Setting up the Project for Building a Web Application</h3><p>Let’s setup a project for building a web app! If you’d like to see more configuration notes, please check out <a href="https://github.com/thheller/shadow-cljs/wiki/Production-Builds">this entry</a> in the shadow github.</p><h4>Augmenting shadow-cljs.edn</h4><p>If you’ll recall in our package.json file:</p><pre>&quot;scripts&quot;: {<br>  &quot;dev&quot;: &quot;shadow-cljs watch app&quot;,<br>  &quot;release&quot;: &quot;shadow-cljs release app&quot;<br>}</pre><p>We have app set in our scripts. This is the name of the build that we&#39;ll make our web app with. We can change this to anything we wish, but we&#39;ll stick with it for now.</p><p>We are going to add some config to our shadow-cljs.edn file:</p><pre>{:source-paths [&quot;src&quot;]<br> :dependencies [[proto-repl &quot;0.3.1&quot;]]<br> :nrepl {:port 3333}<br> ;; NEW STUFF BELOW ;;<br> :builds<br> {:app  {:target     :browser<br>         :output-dir &quot;public/js&quot;<br>         :asset-path &quot;js&quot;<br>         :modules {:main {:entries [app.core]}<br>                   :devtools {:before-load app.core/stop<br>                              :after-load app.core/start<br>                              :http-root &quot;public&quot;<br>                              :http-port 8020}}}</pre><p>Let’s break this down one line at a time:</p><pre>; This key tells shadow what builds we have for our app<br> :builds<br>                            <br>; This is the name we&#39;ll give our first build<br> {:app</pre><pre>; We&#39;re targeting the browser<br>  {:target     :browser</pre><pre>; In our [&quot;src&quot;] where all our build files will go<br>   :output-dir &quot;public/js&quot;</pre><pre>; The destination - relative to the :output-dir - of the compiled Clojurescript<br>   :asset-path &quot;js&quot;</pre><pre>; The :modules section of the config is always a map keyed by module ID.<br>   :modules</pre><pre>; The module ID is also used to generate the Javascript filename. Module :main will generate main.js in :output-dir.<br>   {:main</pre><pre>; The entry file&#39;s namespace. See Note 1) below<br>    {:entries [app.core]}}</pre><pre>; The :devtools section see Reference 2) in the References at the Bottom of this Section<br>   :devtools</pre><pre>; A symbol (with namespace) of a function to run just before refreshing files that have been recompiled.<br>   {:before-load app.core/stop</pre><pre>; A symbol (with namespace) of a function to run after hot code reload is complete.<br>    :after-load app.core/start</pre><pre>; The disk path from which to serve root filesystem requests. If not supplied, no disk files are served.<br>    :http-root &quot;public&quot;</pre><pre>; The port to serve from. See more in References<br>    :http-port 8020}}}}</pre><h4>Notes:</h4><ol><li>:build setup is structured like this:</li></ol><pre>:builds<br> {:app {:target :browser<br>        :output-dir &quot;public/js&quot;<br>        :asset-path &quot;/js&quot;<br>        :modules {:main {:entries [app.core]}}}}}</pre><p>whose file structure should look like this:</p><pre>.<br>├── package.json<br>├── shadow-cljs.edn<br>└── src<br>    └── app<br>        └── core.cljs</pre><p>Notice that the folder structure must mimic the :entries namespace. The convention being that the highest level namespace (app) is a folder right below the src path and first child namespaces (core) is directly under the highest level namespace (app.core = app/core).</p><p>You can find out more about these settings in <a href="https://shadow-cljs.github.io/docs/UsersGuide.html#target-browser">the documentation</a></p><h4>Create an index.html file inside your public directory</h4><p>Create an html file that looks something like this:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>  &lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;title&gt;Starter project&lt;/title&gt;<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    &lt;div id=&quot;app&quot;&gt;&lt;/div&gt; &lt;!-- your build --&gt;<br>    &lt;script src=&quot;/js/main.js&quot;&gt;&lt;/script&gt; &lt;!-- :output-dir --&gt;<br>    &lt;script&gt;app.core.init();&lt;/script&gt;&lt;!-- &quot;Starter file&quot; --&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><h4>Create a Starter File</h4><p>In your core.cljs file (if you&#39;re following along), create a simple starter file like this:</p><pre>(ns app.core)<br><br>(js/console.log &quot;Hey from proto-repl!&quot;)<br><br>(js/alert &quot;foo&quot;)</pre><pre>; This is the :devtools {:before-load script<br>(defn stop [] <br>  (js/console.log &quot;Stopping...&quot;))</pre><pre>; This is the :devtools {:after-load script<br>(defn start [] <br>  (js/console.log &quot;Starting...&quot;))</pre><pre>; This is the `app.core.init()` that&#39;s triggered in the html<br>(defn ^:export init [] <br>  (start))</pre><h3>Fire it up!</h3><p>Now we should be able to restart our shadow in our terminal:</p><pre>npm run dev</pre><p>For Node development — unlike when targeting the browser — you’ll use:</p><pre>(shadow.cljs.devtools.api/node-repl)</pre><p>to wake up ProtoREPL to your build. I made the mistake of not eval’ing this and got stuck for a while trying to figure out what I did wrong. Don’t be like me. Eval!</p><p>Execute the block of code using ProtoREPL (ctrl+, b/ctrl+alt, b):</p><pre>(prn &quot;Hey from proto-repl!&quot;)</pre><p>And you should see: &quot;Hey from proto-repl!&quot; in ProtoREPL.</p><p>Side Note: Here are some of the other things you can do with ProtoREPL</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kYYE2Vn0lNjEsTN3-7phxA.gif" /></figure><p>Now, in your terminal, you should be able to open the file (library.js in this case) in the :output-to directory (public/libin this case).</p><h3>Testing in Node</h3><p>Now, let’s check to ensure everything’s in order for access via Node…</p><p>Change your “super basic” lib/core.cljs file for testing in Node:</p><pre>(ns lib.core)</pre><pre>(defn hello [&amp; cli-args]<br>  (prn &quot;hello world&quot;))</pre><pre>(prn &quot;Hey from node!&quot;) ; test out Node</pre><h3>File Structure Review:</h3><ol><li>:build setup is structured like this:</li></ol><pre>:builds<br> {:lib {:target     :node-library<br>        :output-dir &quot;public/lib&quot;<br>        :output-to &quot;public/lib/library.js&quot;<br>        :exports {:hello lib.core/hello}}}}</pre><p>Your file structure should look like this:</p><pre>.<br>├── package.json<br>├── shadow-cljs.edn<br>└── src<br>    └── lib<br>        └── core.cljs</pre><p>As with other build setups, the folder structure must mimic the namespace. In this case the :exports namespace (lib) is a folder right below the src path and first child namespaces (core) is directly under the highest level namespace (lib.core= lib/core). Also, note that :hello is the exported object from the namespace lib.core/hello. This is how you will require this library in your JavaScript projects. I.e.: var x = require(&#39;)</p><p>The :exports map maps CLJS vars to the name they should be exported to.</p><p>Now, in a new tab/window in your terminal, jump into your public\lib folder and just use the node command to start the runtime.</p><p>.../public/</p><pre>$ cd lib<br>$ node</pre><pre>&gt; var x = require(&#39;./library.js&#39;);<br>&quot;Hey from node!&quot;<br>undefined</pre><p>You should see &quot;Hey from node!&quot;, which we prnted from within the namespace, but - also - we can use our compiled JavaScript from node!</p><p>.../public/lib/</p><pre>&gt; var x = require(&#39;./library.js&#39;);<br>&quot;Hey from node!&quot;<br>undefined<br>&gt; x.hello()<br>&#39;hello world&#39;<br>null</pre><p>If you got this far, you’re ready to rock on your new Node Library! WOOT! You can use the compiled code from any JavaScript program just like a regular module.export :)</p><h3>Using ProtoREPL</h3><p>As with other builds, you can leverage the awesome REPL-driven-development style of clojurescript by waking up ProtoREPL:</p><ol><li>In Atom, fire up your Remote ProtoREPL server (ctrl, y/ctrl+al, y) or search in your <a href="https://flight-manual.atom.io/getting-started/sections/atom-basics/">Atom Command Pallet</a> for ProtoREPL: Remote nRepl Connection using ctrl+shift+p) and connect to your localhost at your port (3333 in this case).</li><li>When ProtoREPL pops up, eval: (shadow.cljs.devtools.api/nrepl-select :lib) and you&#39;re up and running your interactive Node environment!</li></ol><p>If you still have your node session running (via ...require(&#39;./library&#39;) in this case) in your terminal, when you eval a block of code in your project (ctrl+b), you should see the result both in ProtoREPL as well as in your terminal.</p><h4>Caveats</h4><p>You may forget to eval the shadow devtools commands after connecting to your Remote nRepl Connection, in which case you&#39;ll get this warning:</p><pre>No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.</pre><p>ProtoREPL will sometimes kick you out of (shadow.cljs.devtools.api/node-repl) and put you back into it&#39;s default Clojure REPL. In which case you&#39;ll see the following error when trying to eval cljs code:</p><pre>CompilerException java.lang.RuntimeException: Unable to resolve symbol: go in this context, compiling:</pre><p>In either case, If you run into strange issues, you may find it quicker to just use one the following commands:</p><ol><li>Restart ProtoREPL (close the panel)</li><li>Atom Command Pallet: Connect to Proto Repl: Remote nRepl Connection</li><li>In the ProtoREPL</li></ol><pre>(shadow.cljs.devtools.api/node-repl)</pre><p>This should get you back in the saddle. If not, restart shadow (npm run dev) and run through the 4 steps above.</p><p>If you get a warning about an existing alias:</p><ol><li>Atom Command Pallet: Clear all your namespaces: Proto Repl: Super Refresh Namespaces</li><li>Atom Command Pallet: Clear all values: Proto Repl: Clear Saved Values</li><li>Atom Command Pallet: Connect to Proto Repl: Remote nRepl Connection</li></ol><h3>References</h3><ul><li>Shadow-cljs JavaScript <a href="https://shadow-cljs.github.io/docs/UsersGuide.html#_exports">Exports Elaborated</a></li></ul><h3>Next Steps:</h3><p>If you’ve never touched clojure(script) before, get started right away with some <a href="http://clojurescriptkoans.com/">koans!</a></p><p>Or, play with your freshly minted learning environment by cloning some <a href="https://github.com/joakin/diving-into-clojurescript-exercises">practice examples</a>!</p><p><em>Cross-posted from </em><a href="https://github.com/loganpowell/shadow-proto-starter"><em>https://github.com/loganpowell/shadow-proto-starter</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec5e38e3de26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Money and Politics]]></title>
            <link>https://medium.com/@loganpowell/economic-inequality-and-political-polarity-15db8480ca4e?source=rss-51406979288f------2</link>
            <guid isPermaLink="false">https://medium.com/p/15db8480ca4e</guid>
            <category><![CDATA[politics]]></category>
            <category><![CDATA[economics]]></category>
            <category><![CDATA[inequality]]></category>
            <dc:creator><![CDATA[Logan Powell]]></dc:creator>
            <pubDate>Sat, 16 Apr 2016 15:15:40 GMT</pubDate>
            <atom:updated>2023-06-21T14:28:12.527Z</atom:updated>
            <content:encoded><![CDATA[<h2>Money is Politics</h2><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kVSk3rqzA2HB2J-rStT6gw.png" /></figure><h3>Is America Divided?</h3><blockquote>It’s all about money, not freedom, y’all, okay? Nothing to do with fuckin’ freedom. If you think you’re free, try going somewhere without fucking money, okay? — Bill Hicks</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*sO6ziEqFO3WZUWxsA0Twkg.png" /></figure><p>The three sets of overlapping mounds above represent the changing political positions of American Democrats (blue) and Republicans (red) since 1994 (left and right-leaning independents are grouped with democrats and republicans accordingly).</p><p>What’s illustrated by the diverging peak of the red and blue mounds is that <strong>even the ‘center’ of these political parties is becoming more extremist</strong> and thus divided.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*UHU455AaaUl2IIU2URVwqg.jpeg" /><figcaption>The difference in income gains between high and low-income earners over 30 years</figcaption></figure><p><strong>A political-economic change would occur in America’s late 70s/early 80s, which would correlate significantly</strong> with the stratification of income growth unprecedented since the Great Depression.</p><p>From <a href="http://www.people-press.org/2009/05/21/section-1-party-affiliation-and-composition/">Pew Research</a>:</p><blockquote>Party identification is strongly linked to family income levels — people in the highest income households are roughly twice-as-likely as those in the lowest income households to say they are Republicans.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*IXKIu03sCAU5bWVIlsJEOw.png" /><figcaption>Source: <a href="http://www.people-press.org/2009/05/21/section-1-party-affiliation-and-composition/">Pew Research</a></figcaption></figure><p>In the summer before this was written, <a href="http://www.gallup.com/poll/172859/congressional-approval-rating-languishes-low-level.aspx">Gallop polled</a> Americans to ask them what they thought of their decision-makers on Capitol Hill. The results revealed that the lion’s share (85%) of Americans do not approve of their Congress’s work. So what was the most popular answer reported for fixing this deadlock?</p><blockquote>“Fire them all.”</blockquote><p>The result of income polarization and the divisive political fallout is a legislative deadlock, and Americans are <em>pissed</em>. Decision-makers cannot represent their constituency <em>and </em>work across the aisle to compromise on bipartisan solutions because their constituencies can no longer see eye to eye. Increasingly, <strong>they now live in entirely different worlds.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*lIpQf1lGQgtjm6SUZqMYpA.png" /></figure><h3>Taxes and Civilization</h3><p>There’s not much in common between monarchies and democracies, but both have ‘coordination costs.’ These are the shared costs of time and resources required to power an organization’s institutions and infrastructures. These costs go towards facilitating information exchange, decision-making, and the pooling of collective resources of the organization to deploy for the typical ‘good’ (e.g., sewers, bridges, research, militaries, etc.).</p><p>In any form of government, these coordination costs are paid through taxation. The payers of such tax are <em>supposed </em>to be the beneficiaries of the coordination, but — unfortunately — that’s not the way it always works out.</p><h4>“Free Riders”</h4><p>Many fiscal conservatives complain about America’s welfare state’s ‘free riders.’ These people aren’t economically productive and receive government benefits at the tax expense of the laborer. And, to be fair to Conservative concerns, this does represent a significant economic liability. Yet, other free riders are not being given an amount of attention proportional to their cost to society. Does this relatively hidden cost far outweigh that of all entitlement beneficiaries? Where are these free riders? They live in a magical place we now call ‘the 1%.’</p><p>The <em>financial </em>hardship of the Dot-com crash, the Iraq War, and Obamacare COMBINED is just a fraction of the aftermath of the most severe American crisis since the Great Depression. Interestingly, while the Great Recession Cost America <a href="http://www.treasury.gov/resource-center/data-chart-center/Documents/20120413_FinancialCrisisResponse.pdf">$24 trillion</a>, all entitlements (Medicare, Medicaid, Veterans Administration, Social Security, food stamp programs, etc.) over the same period, combined, equate to about <a href="http://www.whitehouse.gov/omb/budget/historicals">$12 trillion</a>. Simple math reveals that the most expensive free riders are not the poor but the <em>super-rich.</em></p><blockquote>100% of Americans paid for the fall of the Great Recession, but the top 1% have taken the lion’s share of the gains from our rebound.</blockquote><p><a href="http://eml.berkeley.edu/~saez/saez-UStopincomes-2010.pdf">Excerpt from a paper from respected Berkeley</a> economist <a href="http://en.wikipedia.org/wiki/Emmanuel_Saez">Emanuel Saez</a>:</p><blockquote>From 2009 to 2010, average real income per family grew by 2.3, but the gains were very uneven. Top 1% incomes grew by 11.6% while bottom 99% incomes grew only by 0.2%. Hence, the top 1% captured 93% of the income gains in the first year of recovery. Such an uneven recovery can possibly explain the recent public demonstrations against inequality.</blockquote><p>As with the division between the colonies and the aristocratic interests of England, the collaborative partnerships within and between the states of America are subject to economic tension between the haves and the have-nots. The problem we face today results from stress caused by extraordinary inequality, not only in wealth but in bearing the <a href="http://www.minneapolisfed.org/publications_papers/pub_display.cfm?id=4438&amp;">weight of the risk</a> of creating that wealth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*5P2zrDCgsexOl2qmk-tumg.png" /></figure><p>Some activities we used to think of as “investing” have proven to cause harmful effects on society similar to — if not worse than — gambling. In modern times with modern technology, it’s time we take a closer look at the nature and social cost of speculation, specifically, what’s known as ‘<a href="http://en.wikipedia.org/wiki/High-frequency_trading">high-frequency trading.</a>’ High-frequency trading, including here <a href="http://en.wikipedia.org/wiki/Day_trading">day trading</a>, is a stock market activity that has nothing to do with ‘investing’ in a company’s fundamentals but is solely a form of <a href="http://www.investopedia.com/ask/answers/09/difference-between-investing-speculating.asp"><em>speculation</em></a>.</p><p>Even if you’re the most extreme conservative, you should also dislike high-frequency trading as it does not ultimately end well for anyone but the traders and <a href="http://en.wikipedia.org/wiki/Algorithmic_trading">algorithmic brokers</a> themselves. How about an exceptionally high capital gains tax for high-frequency trades? I.e., exchanges where the time between buying and selling is <em>shorter than a day. </em><strong>Let’s use tax as a disincentive to </strong><a href="http://web.mit.edu/jcstein/www/for-crash.pdf"><strong>increased volatility closely linked</strong></a><strong> with inflating bubbles and provoking busts.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*5P2zrDCgsexOl2qmk-tumg.png" /></figure><h3>The American Dream</h3><p>The American Dream. We all have this dream, not just Americans. But, <strong>Americans, clever marketers we are, own the brand.</strong> But, unfortunately, we don’t own the franchise. To live the American Dream today, you should probably move to <a href="http://www.theatlantic.com/politics/archive/2016/03/bernie-sanders-nordic-countries/473385/">Scandinavia</a>. So, what is this “American Dream”? Well, economically, it’s “social (or economic) mobility.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*n3UTo-xfKuuYCXVH7RbKww.jpeg" /><figcaption>Source: <a href="http://www.brookings.edu/research/reports/2013/06/13-facts-higher-education">Brookings Institute</a></figcaption></figure><p>If there’s anything Americans want more than anything else, it’s a shot at the good life. <strong>We want an opportunity to succeed and improve our lives. Maybe — one day — be in that 1%</strong>. We want to be rich and know that the game’s rules will enable us to do that <em>if we work hard enough.</em></p><p>If you feel that the stairway that’s supposed to allow you to climb up the economic strata feels like a declining escalator, you’re not crazy. And when compared to our neighbors in Canada or overseas in Scandinavia, that’s not too far from reality.</p><h4>The Social Effects of Extreme Inequality</h4><p><a href="http://www.equalitytrust.org.uk/sites/default/files/attachments/resources/SpiritLevel-jpg_0.pdf"><em>The following data was collected by the World Bank and other sources and analyzed by Richard Wilkinson and his team</em></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*dUHMuQxNNlpdCCpqVMCj8A.png" /></figure><p>How do ‘health and social problems’ relate to income inequality?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*6oOrm8kAM6rlZ4JTiBj3Bg.png" /></figure><h4><a href="http://www.equalitytrust.org.uk/sites/default/files/attachments/resources/SpiritLevel-jpg_0.pdf">Abortion</a></h4><p>Whether <strong>pro-life or pro-choice</strong>, you will probably agree that Americans should be concerned with infant deaths. There are two primary causes of infant death in the US: accidental and via <strong>abortion.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*mvIo-5x522NYmaMYVcuZzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*5EHZMuhCxjYbyTVf6jeXrA.png" /></figure><p>Who is most likely to get an abortion? A poor, abandoned, or otherwise unprepared teen, that’s who.</p><h3>From American Pie to The American Game</h3><p>There will always be winners and losers; the only thing we need to be careful of is that we set the rules to ensure we get the best game. No one enjoys watching a game won using dirty tricks (especially the losers), and — just as the referee’s role in ensuring good sportsmanship — the government’s job is to set the stage for the best game.</p><p>So, what’s wrong with inequality? Nothing is inherently wrong with inequality. It’s natural. The same beneficial competition that creates innovation creates an imbalance. As such, we want a good game, competition, and inequality. The problem becomes when that game is <em>rigged to perpetuate</em> inequality.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15db8480ca4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ecology and Design]]></title>
            <link>https://medium.com/@loganpowell/ecology-and-architecture-d0de9a20228f?source=rss-51406979288f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0de9a20228f</guid>
            <category><![CDATA[ecology]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[ecoregions]]></category>
            <dc:creator><![CDATA[Logan Powell]]></dc:creator>
            <pubDate>Sat, 16 Apr 2016 15:09:34 GMT</pubDate>
            <atom:updated>2020-05-14T11:01:09.275Z</atom:updated>
            <content:encoded><![CDATA[<p>Logan Powell in collaboration with <a href="https://www.linkedin.com/in/laura-keller-aia-leed-ap-bd-c-3295471a">Laura Keller Shue</a></p><p><em>This is a revision and summary of a thesis, submitted in partial fulfillment of the requirements for the Bachelor of Architecture Degree at Auburn University College of Architecture (Thesis year 2006).</em></p><h4>Acknowledgements</h4><p>Thanks are due to the entire faculty at the College of Architecture, Design and Construction for being supportive of their student’s endeavors. I would also like to thank <a href="https://www.linkedin.com/in/bruce-lindsey-1a77036">Bruce Lindsey</a> for promoting sustainable ethics in our school. <a href="https://www.linkedin.com/in/norbert-lechner-12938023">Norbert Lechner</a> has was a welcome mentor to me as well. Also a warm thanks to <a href="https://www.linkedin.com/in/robert-bailey-7b515024">Robert G. Bailey</a> of the U.S. Department of Agriculture for all of his direct help. His generous contribution of time was of great value to this project.</p><h3>Preface</h3><p>The Industrial Revolution spawned a new way of thinking that has become detrimental to our security as a species, the overexploitation of natural resources (lacking the sensitivity to their ability to be renewed) has caused us to rely more and more on artificial means to support humanity. These artificial means further deplete and/or pollute our water, air, and land ultimately making it unsuitable for habitation.</p><p>The surface of the earth is a living organism. The sky, the earth and the water create the stage for all life as we know it. Every part serves the interdependent system. However, unlike the rest of the life on the planet, the human population is taking exceedingly more than it is giving.</p><blockquote>If we are selfish we should be wisely selfish.</blockquote><blockquote>— the Dalai Lama (Tenzin Gyatso)</blockquote><p>It is only right that an architect also be an environmentalist. The Earth is our ultimate shelter. Architects nest their shelters within it. One should not destroy a home to build the rooms within it.</p><h3>Introduction to Ecoregions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9OFuch16AzrXNLGFEghm7w.jpeg" /><figcaption>source: <a href="http://www.fs.fed.us/rm/ecoregions/products/map-ecoregions-continents/">http://www.fs.fed.us/rm/ecoregions/products/map-ecoregions-continents/</a></figcaption></figure><p>Through a century of refinement and investigation, the Earth has been divided into ecological regions or “Ecoregions.” <a href="https://en.wikipedia.org/wiki/Ecoregion">Ecoregions</a> are places that share similar altitude, latitude, and relative continental location (e.g., which provide for a certain climate).</p><p>There are many professions (e.g., forestry, wildlife preservation, agriculture) that use ecoregional data as prescriptive to the most appropriate and/or allowable use of any given site. It has been established that this type of contextual sensitivity is vital to the success of our relationship with our natural environment.</p><h3>Hypothesis</h3><p>Ecoregions can inform designers as well. This natural context provides pressure that can begin to become part of the design process. By incorporating a notion of ecological compatibility or “spirit of place,” we become more efficient, effective and mannerly designers.</p><p>The ecoregional character of a place can persuade many aspects of a formal design solution. However, this requires — from the moment a site is being considered for development — a constant attention to “appropriateness.” Every stage of design development should be with the constant reference to the environment and this requires a sincere respect for the value of our own habitat and health. In order to incorporate these tools to developing more cooperative and appropriate forms, it is of utmost importance to see the proverbial forest for the trees.</p><p>In our society it should also be noted that the only way to ensure the adoption of such a paradigm shift, we must transition/evolve from the current paradigm, namely cosmetics. <strong>In order to be sustainable our designs must be beautiful, but good designers must go deeper.</strong> They must strive now not only to create beauty, but also solve economic problems and — importantly — understand sustainability.</p><h3>Ecoregions and Earth’s Energy Systems</h3><p><em>Here is a brief primer of the energy systems that inform ecoregional categories, peered at through three lenses: Earth, Water and Air.</em></p><h4>Earth</h4><p>The abnormalities of the Earth&#39;s crust (continents, mountains, ocean floors) are primarily due to the dynamic nature of the <em>internal </em>world. Drifting and colliding plate tectonics over <a href="https://en.wikipedia.org/wiki/Deep_time">geologic time</a> create mountains and oceans, i.e., the Earth’s topography. The topography of the earth creates the stage for life-giving water to be carried over (precipitation) and rest into different body types (e.g., rivers, oceans, ponds, marshes, etc.).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*bvGX9Gr8IbhO_QWSsXv3Qg.jpeg" /></figure><h4>Water</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L8ixqy9rsAtL05B6m-iWnA.jpeg" /></figure><p>Oceanic currents bring equatorial water — warmed by the solar energy concentrated there — across the east sides of the continents towards the poles and then from the poles down the western side of the continents.This causes a tendency for the eastern coasts to be warmer than western coasts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*_NiDtUTVIYFUKZqz_mgMUA.jpeg" /></figure><p>The deviation of these oceanic waters also causes an unusually warm climate in the higher latitudes in Western Europe. Here continental temperatures are made much more favorable by proximity to warm oceanic currents brought by the Gulf Stream (where the red transitions to green in the visualization below).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*fp5Gb4HcKrU4xe2euOJURQ.jpeg" /></figure><h4>Air</h4><p><em>External </em>energy sources support life on Earth in two ways:</p><ol><li>Solar energy from the sun warms the surface to a temperature suitable for the presence of liquid water, the foundation of life.</li><li>Kinetic energy from the Earth&#39;s orbit and rotation is our second external energy source. Our orbit creates the conditions which inform our seasons and the Earth’s rotation powers oceanic currents.</li></ol><p>Convection in the atmosphere directly above the surface of the Earth, where the temperature differential between the earth and the air cause convection cells, causes precipitation or the lack thereof. Arid zones are created where this air subsides upon land.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*btWbHsXm5QoN6GsahV5fkQ.jpeg" /><figcaption>The thickness of cells in the diagram above are dramatically enlarged for visualization purposes. To use an analogy as a scale reference, the entire thickness of the atmosphere compared to Earth is approximately proportional to the skin of an apple.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i6zbIvr5DQJdtxHMEyoCcg.gif" /><figcaption>source: <a href="http://earth.nullschool.net/#current/wind/surface/level/orthographic=-19.56,10.04,288">http://earth.nullschool.net/#current/wind/surface/level/orthographic</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RfdRep3MID7hTNuIjQS_Xw.png" /></figure><p>Ecoregions are — simply put — locations on the Earth that share similar ecological characteristics.</p><h3>The Subtropical Division (230)</h3><p><em>NOTE: The focus of our thesis — as being in Auburn, AL at the time — was the Subtropical Division, the ecoregion of the place wherein the thesis was developed. “Think globally, act locally” as they say.</em></p><p>The humid subtropical climate (division 230 in the map below), marked by high humidity and the absence of really cold winters, prevails the eastern sides of the five continents in the lower middle latitudes, and is influenced by trade and monsoon winds. These areas include southern China, Taiwan (Formosa), northern Iran, southernmost Japan, Uruguay and adjoining parts of Brazil and Argentina, the eastern coast of Australia, the North Island of New Zealand and Southeastern U.S. (represented in the map in green).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9OFuch16AzrXNLGFEghm7w.jpeg" /><figcaption>source: <a href="http://www.fs.fed.us/rm/ecoregions/products/map-ecoregions-continents/">http://www.fs.fed.us/rm/ecoregions/products/map-ecoregions-continents/</a></figcaption></figure><h4>Ecological Concerns</h4><p>Today, large areas within this Division have been converted to agricultural croplands, particularly in China. Corn is a major crop in the southern U.S., Cattle production and tree farming are important uses of soils to sandy for field crops. Rice and tea are the most important crops in those parts of China and Japan with similar climate. Major habitat threats include urbanization, industrialization, logging, agricultural expansion, and road building. Some species are further threatened by hunting and the wildlife trade.</p><h3>Similarities in Vernacular Designs Across Subtropical Divisions around the World</h3><p>According to the idea that ecoregions can determine a more sensitive and sustainable design solution, it is imperative to prove in some way this theory. <strong>This thesis tested this hypothesis by collecting the vernacular designs within the same division from around the world and compared them.</strong></p><p>It was found that many similar architectural strategies were employed by cultures of very different peoples from around the world with the only shared context being their ecoregion. Wooden construction, deep overhangs for summer shade, elevated platform plenums and generous openings to encourage ventilation were common devices found to be similar across the world for the Subtropical Division. There were devices of ambient comfort before the advent of the air conditioner after-all! Why don’t we use them?</p><h4>SE USA: The Dogtrot</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MPPdzx-OOdB9_Kvqe_ur_g.jpeg" /><figcaption><a href="http://sharonscrapbook.blogspot.com/2012/07/dog-trots.html">http://sharonscrapbook.blogspot.com/2012/07/dog-trots.html</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zz47OrmuoauQ8H1JsRbjOg.jpeg" /><figcaption><a href="http://www.panoramio.com/photo/60334570">http://www.panoramio.com/photo/60334570</a></figcaption></figure><h4>Southern Korea: Hanok</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lU5edy3FF-n0eO-UdUVW6A.jpeg" /><figcaption><a href="http://k-happytour.com/tour/korea-hallyu-tour/">http://k-happytour.com/tour/korea-hallyu-tour/</a></figcaption></figure><h4>Southern Japan</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wC8FjuQpzrjziS-IupVOPw.jpeg" /><figcaption><a href="https://www.flickr.com/photos/davegolden/514385399/">https://www.flickr.com/photos/davegolden/514385399/</a></figcaption></figure><h4>Southeast China</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R831vROQWYhS9DL--HjIJA.jpeg" /><figcaption><a href="http://homesweet.pw/photos/1230/ancient-chinese-architecture-interior/marvelous-ancient-chinese-architecture-interior-ancient-chinese-interior-architecture-cdfbdffefc">http://homesweet.pw/photos/1230/ancient-chinese-architecture-interior/marvelous-ancient-chinese-architecture-interior-ancient-chinese-interior-architecture-cdfbdffefc</a></figcaption></figure><h4>New South Wales, Australia and New Zealand: Slab Hut</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iqhDtN1Xn2_siIu1Tp8tpQ.jpeg" /><figcaption><a href="https://en.wikipedia.org/wiki/Slab_hut">https://en.wikipedia.org/wiki/Slab_hut</a></figcaption></figure><h4>Evolved Vernacular Devices of the Subtropical Ecoregion</h4><ul><li>Steeply pitched roofs dealing with heavy rains</li><li>Deep eaves and/or covered perimeter exterior spaces to shed rain and provide shade</li><li>Elevated platform floors to allow ventilation to flow around entire envelope and reduce ground exposure to insects/pests</li><li>Primarily wood construction due to material availability</li><li>Breathing spaces: high ceilings, ventilated attics and transoms to allow heat to rise and exhaust through the building. Breezeways and other generous perforation with tall windows/openings to encourage cross-ventilation</li></ul><p>By looking at these examples, you might begin to actually <em>feel </em>the power of the sun and balmy humidity of these environments. If you can put yourself there, you might then imagine seeking refuge from those elements under the roof of one of these shelters.</p><h3>Conclusion</h3><p>This work just begins to scratch the surface of what we might learn by looking at solutions evolved within similar ecoregions. I am certain that this study would have been further developed — even if by a small measure — had we the modern tools and data now open and freely available online. We had to find books to collect the original content, can you imagine? We actually went to libraries!! In contrast, I needed (and had) only a brief moment, while revising and summarizing, to look online for available images by specific locations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MYg3746F7BvmQaFaRy65ig.jpeg" /><figcaption>A computerized visualization that displays the mosaic-like nature of the ecoregions of U.S. and the diffusion between ecoregional boundaries</figcaption></figure><h4>Opportunity for Further Study</h4><p>There are <a href="http://www.geobabble.org/~hnw/esri98/">new methods</a> for categorizing ecoregions through purely quantifiable means. There are an ever-increasing number and variety of open datasets available which could help us refine our knowledge of the similarities between disparately located places around the world in a manner that would allow us to share lessons learned towards focused and useful ends. There are <a href="http://ecoexplorer.arcgis.com/eco/">new tools</a> to analyse these data. There are many opportunities for further study, refinement of hypothesis and application. I wish I had more time to showcase for you examples of how this is used in other fields, I know the potential is there, but — for one — <a href="https://en.wikipedia.org/wiki/Precision_agriculture#Economic_and_environmental_impacts">agricultural innovation</a> is very much aligned with this prescription.</p><p>In short, this work has only just begun.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0de9a20228f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hedonism: You’re Doing it Wrong]]></title>
            <link>https://medium.com/@loganpowell/hedonism-youre-doing-it-wrong-8e5f09ed8a78?source=rss-51406979288f------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e5f09ed8a78</guid>
            <category><![CDATA[addiction]]></category>
            <category><![CDATA[hedonism]]></category>
            <category><![CDATA[hot-cognition]]></category>
            <category><![CDATA[pleasure]]></category>
            <category><![CDATA[habits]]></category>
            <dc:creator><![CDATA[Logan Powell]]></dc:creator>
            <pubDate>Mon, 06 Oct 2014 22:59:18 GMT</pubDate>
            <atom:updated>2026-09-18T01:21:44.070Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ryYE_3_HNJxCteV5ybCzpw.jpeg" /><figcaption>Stop trying so hard.</figcaption></figure><h2>Hedonism: You’re Doing it Wrong.</h2><p>Without a proper introduction to <a href="http://en.wikipedia.org/wiki/Hedonism">hedonism</a>, we might live out our lives without benefiting from some of the most refreshingly honest and profoundly valuable ideas regarding how to lead an ethical life. How? Through seeking to understand how we are to maximize our experience of pleasure.</p><h3>Endowed by Our Creator</h3><p>In 1776, when crafting the United States Declaration of Independence, the authors wrote into its preamble their best interpretation of the rationale for separating from England:</p><blockquote>When in the Course of human events, it becomes necessary for one people to dissolve the political bands which have connected them with another, and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and of Nature’s God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation.</blockquote><blockquote>We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and <strong>the pursuit of Happiness</strong>…</blockquote><h4>An “Unalienable Right”</h4><p>As it is apparent, the Declaration of Independence submits <em>the pursuit of happiness (</em>endowed by life and enabled by liberty) as a justification for the war. The revolutionary text articulates a radical political system not regulated by obedience to any arbitrarily granted authority or humility before any god but by an ethic powered by the happiness-seeking desires of each citizen.</p><h3>Hedonism</h3><p>‘<a href="http://en.wikipedia.org/wiki/Happiness">Happiness</a>’ From Wikipedia:</p><blockquote><em>Happiness is a mental or emotional state of well-being characterized by positive or </em>pleasant<em> emotions ranging from contentment to </em>intense joy.</blockquote><p>‘<a href="https://en.wikipedia.org/wiki/Hedonism">Hedonism</a>’ from Wikipedia:</p><blockquote><em>Hedonism is a school of thought that argues that pleasure is the primary or most important intrinsic good. In very simple terms, a hedonist strives to maximize net pleasure (pleasure minus pain)… </em>Ethical hedonism is the idea that all people have the right to do everything in their power to achieve the greatest amount of pleasure possible to them, assuming that their actions do not infringe on the equal rights of others.</blockquote><p>Ergo, the Declaration of Independence is a Hedonist manifesto.</p><h3>Determinism</h3><p>Over millennia, human cultures have evolved and branched into a wide variety across the Earth’s dynamic surface. As life forms developed in structure or function — adapting to their climate, availability of resources, geographic isolation, neighboring populations, etc. — each culture has developed specialized<strong> </strong>organizational structures, systems, processes, and technologies of self-preservation and multiplication.</p><p>Unlike the ethic outlined in The Declaration of Independence, many of the world’s organizational systems have enforced the <em>suppression</em> of our pleasures for the benefit of the group. But is the tension between our individual experiences of joy and the greater good necessarily a zero-sum game?</p><p>Hedonists say “no.” If we cannot maximize an individual’s experience of happiness, how can we maximize the world’s happiness?</p><p>Happiness is not something given to us but is something that we develop within ourselves, and each of us needs freedom (and therefore should not impinge on the freedom of others) to create a happier world.</p><h3>What Gives Us Pleasure?</h3><p>Even after a fulfilling meal, after overindulging in the desert, our desire can transform into physical pain. We might regret when the mirror reveals our choices. We may first find delight in the company of another that — after spending more time with them — has a similar effect. We may splurge shop and a month later find ourselves asking, ‘why did I waste my money on this?!’</p><blockquote>We buy shit we don’t need, with money we don’t have, to impress people we don’t like. — George Carlin</blockquote><h4>Brain Candy</h4><p>Serotonin, endorphins, testosterone, estrogen… there are a bunch of chemicals produced by the body to regulate our metabolism and mood, but — since our prime interest is (as it should be) pleasure — we’re going to want to focus on <a href="http://en.wikipedia.org/wiki/Dopamine">dopamine</a>.</p><p><strong>Dopamine is the happy hormone</strong>. The release of this neurotransmitter is <em>triggered </em>when we fulfill our thirst or hunger, taste something sweet, take a dump, have an orgasm, etc. In a nutshell, it’s a signaling hormone that reinforces behaviors necessary for survival and reproduction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*1gHs5dcBa0Vj3S-VyAG_-A.png" /><figcaption>image source: <a href="http://163.178.103.176/Fisiologia/neurofisiologia/Objetivo_9/brain.html">Clayman: The Primitive Brain</a></figcaption></figure><h4>The “Pleasure Center”</h4><p>No, it’s not an adult superstore…</p><p>The mechanics of how dopamine simultaneously facilitates our experience of pleasure and shapes our behavior are profound but also incredibly simple. You see, there’s this primitive little transmission system (shared by all mammals) within the brain:</p><ol><li>The <a href="http://en.wikipedia.org/wiki/Limbic_system"><strong>limbic system</strong></a><strong> (</strong>pictured here<strong>) is responsible for most of our instinctual </strong>(emotion-based)<strong> behavior</strong>. It is the driving force of the pleasure center.</li><li><strong>The brain’s pleasure center’s primary function is to help us learn necessary skills</strong>. How? When a release of dopamine has triggered, a feeling of pleasure is ‘turned on’, <a href="http://www.jneurosci.org/content/21/2/676.short">reinforcing those behaviors that lead us to the <strong><em>on </em></strong>switch</a> (e.g., foraging for food, mating, catching prey, etc.). This feedback loop awakens and strengthens our instincts, giving us the curiosity to try new things and the desire to develop skills in attaining the things that make us happy.</li><li>Dopamine is translated into pleasure by <a href="http://en.wikipedia.org/wiki/Dopamine_receptor"><strong>receptors</strong></a> within the brain’s pleasure center. Soon after experiencing something <em>exciting</em>, the work of translating dopamine into pleasure will ‘fatigue’ the receptors. If not given enough time to rest between doses, the next helping of dopamine will feel less pleasurable than the previous, preventing the second slice of cake from giving us the same amount of pleasure as the first. <strong>This fatigue is also known as developing a ‘tolerance.’</strong></li></ol><blockquote>Whenever a thing is done for the first time, it releases a little demon.<br> — Emily Dickinson</blockquote><p>Remember your first kiss? Ever wonder why the first time you did something <em>new </em>that you found exciting/pleasurable, you formed a strongly associated memory that you’ve carried with you since?</p><p>When we experience something extraordinarily pleasurable, our brains effectively record a high-resolution, multidimensional snapshot of our senses: what we smell, see, hear, touch, and taste. The evolutionary functionality of this allows us to spontaneously identify circumstances in the future that seem familiar to that memory so we can modify our behavior and increase our chances of reliving the ‘high.’ This recording is called a <em>trigger </em>and the sense of opportunity: <em>intuition.</em></p><p><strong>Food for thought:</strong></p><ul><li><em>Identify your dopamine triggers as such.</em></li><li><em>Prepare when you can predict experiencing those triggers to add sophistication to your automatic response.</em></li></ul><h3>Appetites</h3><p>Along these same lines, as we mature, we find that the things that gave us pleasure when we were younger no longer do the trick. We need new and stronger experiences to trigger our interest: robust flavors, designer shoes, travel, “sex, drugs and rock’n roll,” etc… Why?</p><p>Just as these dopamine receptors get fatigued<em> </em>by small pleasures, they can become <strong>worn out </strong>by extraordinarily exciting/pleasurable experiences. These effects reduce our ability to experience pleasure in general. We develop a new object of desire, all other desires taking a back seat. We’ve thus acquired <strong>a new appetite</strong>.</p><p>The appetite-building process follows our growth and development from infancy to adulthood. Roughtly speaking, these are our maturing desires in terms of appetite building:</p><ol><li>Metabolic desires (i.e., ‘needs’): security, sleep, nourishment, excretion</li><li>Novelty desires: curiosity, exploration, discovery</li><li>Relationship desires: companionship, inclusion, sex, communication, self-expression, community</li></ol><p>Depending on our environment, these appetites will form in different ways. The farmer’s child is more likely to enjoy skeet shooting while his cousin in the city develops an appetite for art.</p><h3>Communication</h3><p>Over the past million years, as <a href="http://www.nature.com/ncomms/2014/140827/ncomms5747/abs/ncomms5747.html">social animals</a>, we have been developing an exceptional tool to help us work together: <a href="http://en.wikipedia.org/wiki/Origin_of_language">the ability to communicate complex ideas</a>. Through communication, we can imagine/visualize shared information through description, instruction, and storytelling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*oWTCA5ZAIC9H946wwlTRgA.png" /><figcaption>Rock painting at Tassili n’Ajjer, Algeria. © <a href="http://www.rsc.org/learn-chemistry/resource/res00001541/style-in-cave-paintings">DPK-Photo / Alamy</a></figcaption></figure><p>Early human communication likely had the same practical purposes many <a href="http://en.wikipedia.org/wiki/Animal_communication">animals</a> gained from communicating. For example, they helped us call to our parents for food, alert each other of danger, and coordinate hunts for the larger and <em>tastier </em>game (e.g., mammoths and buffalo). Later, they helped us hand down practical technologies and methods from generation to generation.</p><p>Just as we, individually, build highly expressive vocabularies — from childhood — upon simple phonetics and words, each generation of evolving humans built a new vernacular structure on the work of the last. Early on, sentence structures would emerge, then storytelling architectures, and later, the propensity for dramatization, plot twists then background music. Stories would evolve into legends, epics, myths, folk songs, movies, etc.</p><p>As language developed, it would move from a practical means to a desirable end to an end in itself. Then, in a cultural explosion, humans would give rise to a spectacular diversity of art forms seeking to titillate the senses differently.</p><h4>Informing Perceptions</h4><p>Stories originally served to explain the world and perpetuate culturally encouraged behaviors. By invoking fear, stories would discourage ‘bad’ behavior. By inspiring ambition, stories would encourage and inspire model behavior (courage, honesty, chivalry, etc.).</p><p>Those early storytelling experiments have now evolved into an advanced and deliberate science. Political propaganda would replace ghost stories; advertisements would replace our desire to become heroes with a desire to buy the latest gadget.</p><h4>“We are governed… largely by men we have never heard of.”</h4><p>At the turn of the century, there arrived an innovator in storytelling who would take selling products and politics to a new state of the art: <strong>Edward Bernays.</strong></p><p>From <a href="http://en.wikipedia.org/wiki/Edward_Bernays">Wikipedia</a>:</p><blockquote><em>Edward Louis Bernays (November 22, 1891 − March 9, 1995) was an Austrian-American pioneer in the field of public relations and propaganda, referred to in his obituary as “the father of public relations.” He combined the ideas of Gustave Le Bon and Wilfred Trotter on crowd psychology with the psychoanalytical ideas of his uncle,</em><strong><em> Sigmund Freud</em></strong><em>.</em></blockquote><p>In his book <a href="http://en.wikipedia.org/wiki/Propaganda_(book)">Propaganda,</a> Bernays says:</p><blockquote><em>If we understand the mechanism and motives of the group mind, is it not possible to control and regiment the masses according to our will without their knowing about it? The recent practice of propaganda has proved that it is possible, at least up to a certain point and within certain limits.</em></blockquote><p>He called this scientific technique of opinion molding the ‘engineering of consent.’ In his book, Bernays posits:</p><blockquote><em>The conscious and intelligent manipulation of the organized habits and opinions of the masses is an important element in democratic society. Those who manipulate this unseen mechanism of society constitute an invisible government which is the true ruling power of our country. </em><strong><em>We are governed, our minds are molded, our tastes formed, our ideas suggested, largely by men we have never heard of.</em></strong></blockquote><p>Bernays revolutionized the art of advertisement and propaganda. The lessons he incorporated from his uncle Freud’s toolbox (which he helped popularize in the US) into his framework remain canonical within the public relations and advertisement industry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*8xnjsJKlptw8gWN47UApPA.png" /><figcaption>The American Tobacco Company hired Edward Bernays to address the stigma surrounding women and smoking. The risky campaign proved to be a great success, and scores of women took up smoking.</figcaption></figure><h4>“Image is Everything”</h4><p>Edward Bernays understood that our natural inclination — whether we like to admit it or not — is to idealize or internalize images promoted or villainized by those we trust and that we are inclined to trust the news, which he would often leverage for his promotions.</p><p>Just as we can be triggered to climb a tree if we believe a story from a friend that there’s a tasty bundle of bananas at the top, the sight of someone <em>slow-mo </em>chomping into a juicy double cheeseburger compels us to haul our jiggly ass to Mickey D’s. By framing information in a certain way, we can nudge others’ behavior.</p><p>We become afraid of imaginary monsters when we see horror films as children. As adults, we see images of murder on the local news, creating a fear of our neighbors. The exploitation portrayed in pornography encourages us to approach sex partners as sex objects. Every girl’s gotta buy what the newest version of Paris Hilton is wearing. We thus accumulate unnatural fears and nurture strange desires.</p><p>This information embellishment calls for a Hedonist’s (<a href="https://medium.com/@loganpowell/what-is-pragmatism-ed85f1e7a46b">as well as a </a>pragmatist’s) solution and is why it’s best to steer clear of too much fiction or staged ‘reality.’ Real life is more rewarding when we approach it with <em>realistic </em>expectations. Not that we shouldn’t dream, but we should first seek to know ourselves, then create our dream. Don’t let someone else (especially “<em>men we have never heard of”) </em>determine what that dream should be.</p><blockquote>Fun fact: Mark Bernays Randolf (Cofounder of Netflix) is Ed’s great nephew</blockquote><h4>Don’t Believe the Hype</h4><p>During <a href="http://en.wikipedia.org/wiki/Jane_Akre">a trial</a> over obfuscation of facts, Fox News asserted that, under the First Amendment, broadcasters have the right to lie or deliberately distort news reports. Given this and other cases of misuse of such power, we must be careful when receiving information from religiously, politically, or commercially motivated gatekeepers.</p><p><strong>Food for thought:</strong></p><ul><li><em>By looking for ‘clean’ information (</em><a href="http://www.cdc.gov/des/consumers/research/understanding_deciding.html&#39;"><em>from reputable sources</em></a><em>), we are more likely to react appropriately to the world and — thereby in our OWN best interests.</em></li></ul><h3>Looking for Love in All the Wrong Places</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*uPXf3sRjNe5mVwPL0VgzkQ.jpeg" /><figcaption><strong>Epicurus (</strong>Greek: Ἐπίκουρος, “ally, comrade”; 341–270 BC)</figcaption></figure><p>One of the pioneers of hedonism, <a href="http://en.wikipedia.org/wiki/Epicurus">Epicurus</a>, strongly criticized advertisement’s rudimentary forms. Even in the 4th century BC ancient Greece, Epicurus saw the destructive potential of advertising in its early stages, attempting to take advantage of our pleasure-seeking brains by promising us one or more of the three things that we need to be happy: <strong>an analyzed life, freedom, </strong>and <strong>friends (</strong>sound familiar?). He felt so strongly against advertising that he proposed counter-advertisements (imagine a billboard showing an obese couch potatoe next to a double cheeseburger) as an ‘antidote.’</p><p>In another triad, Epicurus categorized <a href="http://www.iep.utm.edu/epicur/#SH5c">three types of desire</a>:</p><ol><li><strong>Natural and necessary desires</strong>: food, clothing, shelter, etc.</li><li><strong>Natural but unnecessary desires</strong>: luxury items. Epicurus was a vegetarian and practiced mild asceticism.</li><li><strong>“Vain and empty” desires</strong>: power, wealth, fame, etc. These are difficult to satisfy because they have no natural limit.</li></ol><p>In a similar approach to life that the <a href="http://en.wikipedia.org/wiki/Dukkha">Buddhists teach</a>, the Hedonist Epicurus encouraged the elimination of pain caused by the last two types of desires to attain tranquility and maximum pleasure. He relished<em> </em>simple pleasures every day, and — he argued — this was the way to happiness. How do we appreciate life in this way?</p><p>To maximize our pleasure, we must actively engage in those of our behaviors that prove ultimately pleasurable (more pleasure returned than pain cost/invested). If we are thus constantly engaged, all of our waking hours will give rise to satisfaction. Yet, knowing what we find ultimately pleasurable is not so straightforward.</p><h3>No Pain, No Gain</h3><p>We either pay for pleasure before or after we benefit from the experience. For example, going for that morning run is not pleasurable (for most), nor is getting out of bed an hour early to do it, but it pays off in having more vitality/energy the rest of the day (note: I don’t run, I hate running, but I’ve done it a couple of times… and that’s basically how it went). When taking drugs, lying, or stealing, it’s the opposite payoff sequence; we get the pleasure immediately and pay for it afterward.</p><h4><a href="http://dealbook.nytimes.com/2014/01/07/the-real-belfort-story-missing-from-wolf-movie/?_php=true&amp;_type=blogs&amp;_r=0">Jordan Belfort</a>: Before</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*Oqca3Xd27wJ4lon9jQ71FQ.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*JtaDuWXyELJg4SM4e1_PMA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*RzAL1ijU2cODwh1we7_YCg.jpeg" /></figure><h4><a href="http://dealbook.nytimes.com/2014/01/07/the-real-belfort-story-missing-from-wolf-movie/?_php=true&amp;_type=blogs&amp;_r=0">Jordan Belfort</a>: After</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*WmRy0c4LTtiAK6BrmdwBuQ.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*seVvpePfyQV5y7H630vSsA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*rOUeVMnussjN_RgODQtU3g.jpeg" /></figure><p>Many addicts will tell you they feel like they have a hole inside them, one that can only be filled by their habit. More often than not, these ‘negative’ (enjoy first, pay later) pleasures of debt are not ‘fixing’ their pain but are exacerbating it.</p><p>When faced with a suspicious desire, the appropriate Hedonist questions to ask yourself is “is this worth the trouble?” and — as a Hedonist — if we estimate the aftermath of the pleasure will amount to more pain than it’s worth, the answer to the question should be a definite ‘No.’ You may be saying to yourself “Yeah Logan, but there are a bunch of things I enjoy now that I didn’t really want to do before I tried them.” My only response would be you also don’t know how happy you would be now if you hadn’t tried them.</p><p>So, how can we choose the behavior that will maximize our pleasure? Unlike the objective world, enjoyment varies subjectively from person to person. But, we can still discuss the subjective nature of happiness productively if we understand that anything that will bring us enduring happiness/pleasure will require effort.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fembed-ssl.ted.com%2Ftalks%2Fmihaly_csikszentmihalyi_on_flow.html&amp;url=http%3A%2F%2Fwww.ted.com%2Ftalks%2Fmihaly_csikszentmihalyi_on_flow%3Flanguage%3Den&amp;image=http%3A%2F%2Ftedcdnpe-a.akamaihd.net%2Fimages%2Fted%2F7f50d157bb900f685674fda9a979c92f48e1102b_240x180.jpg%3Flang%3Den&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=ted" width="560" height="315" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad6d799c946f5ca4d4e159f476e8fe1e/href">https://medium.com/media/ad6d799c946f5ca4d4e159f476e8fe1e/href</a></iframe><p>Mihály Csíkszentmihályi wrote a book about what he calls ‘<a href="http://en.wikipedia.org/wiki/Flow_%28psychology%29"><em>flow</em></a><em>.’ </em>In a nutshell, one achieves flow when one — who is practicing a skill they enjoy — experiences when the challenge is just above their current ability. This practice enables them — with just a bit more effort than before — to succeed in meeting the challenge. Flow is what we feel when participating in addictive <em>and healthy </em>behavior. Just as we can build appetites for consumption, we can also build cravings for performing an activity.</p><p>It’s important to remember that the goal has to be <em>almost within reach</em>, just as Epicurus knew 2400 years ago; if we find that we desire more than we can attain, we will always find ourselves wanting. Improvement is a rewarding but slow process and should be enjoyed one step at a time.</p><p><strong>Food for thought:</strong></p><ul><li><em>The lesson is not to compare ourselves to ideals but to ourselves yesterday. So what can you add to the formula you used yesterday to improve your experience today?</em></li><li><em>Find your zone.</em></li></ul><h3>Learning How to Practice</h3><p>Learning is the only higher pleasure we are left with after our primitive needs are satisfied. However, learning <em>how </em>to learn is something we don’t learn in school. Therefore, it’s a personal skill we must pick up along the way. We must take this on ourselves because it is a very private matter and, therefore, challenging to teach.</p><p>For some, operating within the enigmatic flywheel of pleasure and pain can be confusing, discombobulating. Getting to know ourselves and what activities/behaviors will give us maximum pleasure takes time, and it’s a challenge in and of itself because our surroundings change. In addition, we change (we grow up, go through puberty, moods, hormone imbalances, etc.). But, there are ways we can enhance our everyday pleasurable experiences through practice.</p><p>What does almost every religion on Earth have in common? First, they all stress the importance of introspection and reflection in leading a happy life. Call it meditation or prayer; the value of this practice seems well-established. To make sense of the world and our changing place within it, we must sort out what is working for us from what is not. This sorting is how we learn and build our skills, including life.</p><p><strong>Food for thought:</strong></p><ul><li><em>What motivates you? What gets you excited and why? Think about it. Try new things.</em></li><li><em>Find something you enjoy doing for the practice itself, not just in the hope of attaining some goal.</em></li></ul><p>A quick way to tell if someone’s a liar is if they tell you they don’t regret <em>anything</em>. If they didn’t regret acting like an eight-year-old monkey up in that tree that they fell out of, breaking their arm, they’d be a 40-year-old banana sandwich. Regret is our most eloquent teacher. So try, fail, and regret, but think about why you failed. Just try not to regret the same thing more than once. If you got into it because you wanted to try something new, just lean in harder on that instinct. Go deep. You may find that you just tried incorrectly or you may find that you should try something else entirely.</p><h3>Patience as a Pleasure</h3><p>In some situations, <em>nothing </em>is the best thing to do: silence, patience, fortitude, non-participation, awkward pauses in a conversation. There are a number of these kinds of behaviors that many of us must deliberately practice as they are not instinctual.</p><p>The real opportunity for happiness comes from an understanding that certain types of pain can be enjoyable as they improve our capacity for pleasure. If we see the struggle as an exercise, hunger as an appetizer, and the failure as a lesson — we can improve in skill and, thereby, success/happiness now and in the future.</p><p>At the center of almost every ‘unnecessary’ or ‘unnatural’ desire, you will find a seed of impatience. Not wanting to wait for the hunger to apetize, so resort to uber-sweet, salty, or overly extravagant foods. Not wanting to spend the time earning/developing real friendships and so buying a fancy car to impress people leads us into ‘friendships’ based not on respect for the person but their possessions.</p><p>This superficial valuation leads us to believe that the meal is more important than the company with whom it’s shared. It leads us to enter partnerships without trust/respect, sex without intimacy/emotion, and obesity without nutrition.</p><p>The revered composer Claude Debussy said, “Music is the space between the notes.”<strong> </strong>Patience enables us to enjoy both the emptiness and the fullness of life, the hunger and fulfillment, the seclusion and the party, the silence, and the music. It is a skill of happy living, and we should also find a way within ourselves to enjoy the practice.</p><h3>Conclusion</h3><p>The way we accumulate appetites will differ between us as we go through life with less or more exposure to the various stimuli available in our environment.</p><p>The tricky part of making the right move comes not from self-denial but from <em>radical </em>self-awareness. If you are anything like me, you’re weak to your desires. If this is the case, you’ll struggle with them. Pleasure can be a <em>beast, </em>and if we don’t take the time to understand it, just as a beast, it will tear us, our families, and friendships (and, I argue, the world itself) to pieces.</p><p>If watching Sex and the City makes you want to buy something that would stress your bank account, stop watching it. If you’re tired of your kid whining that he wants McDonald’s every time he sees a commercial on his iPad, take the iPad away. If you start sleeping with strangers after the fifth drink, stop at the fourth.</p><p>Understand these choices as self-rewarding, not self-punishing. When indulging, try to savor each pleasure. Don’t multitask. Focus. Focus even on the space, the emptiness. Enjoy these moments. With the right mindset, anticipation can be a significant part of the pleasure and, when matured, makes the consummation even better.</p><p>As The Most Interesting Man in the World says:</p><blockquote>Stay thirsty my friends.</blockquote><p>Indeed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e5f09ed8a78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Machiavellian Pragmatism]]></title>
            <link>https://medium.com/@loganpowell/what-is-pragmatism-ed85f1e7a46b?source=rss-51406979288f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed85f1e7a46b</guid>
            <category><![CDATA[pragmatism]]></category>
            <category><![CDATA[peirce]]></category>
            <category><![CDATA[philosophy]]></category>
            <dc:creator><![CDATA[Logan Powell]]></dc:creator>
            <pubDate>Wed, 24 Sep 2014 01:23:58 GMT</pubDate>
            <atom:updated>2026-09-04T13:28:22.521Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JfX_hDb6N-YA5oLPMOmQig.jpeg" /></figure><p>How the greatest craft of American philosophy was hijacked.</p><p>Today, we typically employ the concept of Pragmatism in a commercial, sporting, or political context wherein the <strong>goal </strong>warrants <em>whatever it takes to get the job done</em>. The only redeeming quality that lingers with the term is the connotation that the employed tactics are considered efficient/effective.</p><p>‘<a href="http://en.wikipedia.org/wiki/Pragmatism">Pragmatism</a>’ along with ‘skepticism,’ ‘<a href="https://medium.com/@loganpowell/hedonism-youre-doing-it-wrong-8e5f09ed8a78">hedonism</a>,’ ‘idealism,’ ‘materialism,’ etc., are philosophical terms, each referring to a distinctly different school of philosophy. Moreover, each word has picked up or lost meaning through the social evolution of being co-opted, translated, and interpreted over time. Unfortunately, like in the childhood <a href="http://en.wikipedia.org/wiki/Chinese_whispers">game of telephone</a>, philosophical terms can be accidentally or deliberately distorted through this grapevine.</p><p>For Pragmatism, this distortion was deliberate, disruptive, and — adding insult to injury — rendered by the philosopher’s best friend.</p><h3>“The Prince” is not Pragmatic.</h3><p><a href="http://plato.stanford.edu/entries/machiavelli/">Nicolò Machiavelli</a> dedicated his book ‘<a href="http://en.wikipedia.org/wiki/The_Prince">The Prince</a>” to a famous Italian <a href="http://en.wikipedia.org/wiki/Lorenzo_de%27_Medici">Medici</a> banking family member, which outlines tactics on how he could most easily seize and maintain power from neighbors and other rulers abroad. These tactics included: brutal punishment, military occupation, revenge, and massacring entire bloodlines, but — because these were deemed <em>efficient means </em>to the desired end of empowering a philanthropic family (the Medicis were ‘good’ folks and all) — the treatise is sometimes described as ‘pragmatic.’</p><p>However, in stark contrast to this ‘Machiavellian’ interpretation, Pragmatic theory criticizes primarily self-centered means within its original texts. In <a href="http://www.iupui.edu/~arisbe/menu/library/bycsp/evolove/evolove.htm">one example</a>, the founder of the philosophy wrote:</p><blockquote><em>…the conviction of (our times) is that progress takes place by virtue of every individual’s striving for himself with all his might and trampling his neighbor underfoot whenever he gets a chance to do so. This may accurately be called the Gospel of Greed.</em></blockquote><p>So, how did we get here? How did Pragmatism (with a capital P) mutate from being a rallying cry against this Gospel of Greed into its philosophical champion?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wKD6J7BHP8gjh_XJJCDJNw.png" /></figure><h3>The First Book</h3><p><a href="http://en.wikipedia.org/wiki/Charles_Sanders_Peirce">Charles Peirce</a> (pronounced ‘purse’) — the originator of the philosophy of Pragmatism and coiner of its name — was also a founding member of <a href="http://en.wikipedia.org/wiki/The_Metaphysical_Club">a tiny social club in Cambridge, MA</a>, of what would become a group of highly influential American thinkers. Of the group, he was the most arrogant, caustic, haunted, and brilliant.</p><p>However, Peirce was not the author of the <a href="https://www.goodreads.com/book/show/681508.Pragmatism?from_search=true">first book</a> to bear Pragmatism’s name. In 1907, as Plato did for Socrates (and some would say with a similar <a href="http://plato.stanford.edu/entries/socrates/#SocProWhoWasSocRea">suspect</a>), his colleague and best friend, <a href="https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;cad=rja&amp;uact=8&amp;ved=0CCAQFjAA&amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FWilliam_James&amp;ei=A6YgVNm-A8_jsASgu4GIBw&amp;usg=AFQjCNFBuY1dXshWFSQTzpNITeZtV-qE3w&amp;sig2=Hta34cm3ISEWIrMPkrQO_w&amp;bvm=bv.75775273,d.cWc">William James</a>, published it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*FPFbeSgNkXilH8ZS84e1tw.png" /><figcaption>(Peirce: left, James: right) source: <a href="http://www.nybooks.com/galleries/david-levine-illustrator/1969/jan/30/c-s-peirce-and-william-james/">New York Review of Books</a></figcaption></figure><p>James’ <a href="http://www.goodreads.com/book/show/681508.Pragmatism">book</a> would help to solidify Pragmatism as the most important American contribution to the philosophy that it remains today, and we might thank him for this. However, James’ subtle but profound spin on Peirce’s philosophy would strain this friendship until its end.</p><h4>The Proof is in the Pudding</h4><p>Starting with where James and Peirce agree, all “Pragmatists” argue that there is no absolute truth. <a href="http://www.peirce.org/writings/p107.html">‘Truth’ is a belief that is strong enough to ‘fix’</a> one’s behavior in a particular situation. And as even deliberate, rational behavior varies from person to person when dealing with the same situation, so do their versions of the truth. The Pragmatists posit that <em>our actions show what we really believe is true</em>.</p><h3>Two Sides of the Same Coin</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*woP_74sPTCLI7nssaUB5EA.png" /></figure><h3>Heads or Tails?</h3><p>Though multiple people might experience the same situation, their version of the ‘truth’ of the matter will vary — to a greater or lesser degree — not because they saw different things but because <em>they saw the same thing differently</em>. There are two levels to this:</p><ol><li><strong>People differ in various ways</strong>, for example, their sensory abilities/disabilities, cultural, personal, and professional prejudices, previous experiences, physical proximity to specific events/objects, etc.</li><li><strong>Our concerns differ because of this variety</strong>, which focuses us on different aspects of our experience, taking different lessons away from a situation into <em>our </em>version of the ‘truth.’</li></ol><h4>The Pragmatic Maxim</h4><p>For the most part, we can understand this. But, of course, we are different and don’t see eye-to-eye on everything (ok… on anything). But <em>why </em>do these personal differences affect the way we see things? Peirce drilled down into this but tried to summarize his ideas using a <a href="http://en.wikipedia.org/wiki/Pragmatic_maxim">Maxim</a>:</p><blockquote>Consider what effects, that might conceivably have practical bearings, we conceive the object of our conception to have. Then, our conception of these effects is the whole of our conception of the object.</blockquote><p>My quick and dirty translation:</p><p><strong>You see things the way you think you <em>might </em>find them useful.</strong></p><p>Accordingly, the structure within Peirce’s Pragmatism that caused James’ desire to alter it was their version of what they regarded as truth. Though both felt reality and truth as a “social construct.” However, Peirce’s truth required statistical evidence of unbiased/sound data, whereas James’ encouraged a man’s “true” beliefs. James was a diplomat, Peirce a rigorous scientist. To James, faith served the same purpose for Christians as statistics/data served to give a scientist: <strong>confidence.</strong></p><p>James had good intentions in changing Peirce’s philosophy this way; sensing its potential, he wanted to open Peirce’s unrelentingly scientific doctrine to people of faith (in those days — much as it is now — many people of influence). His formula was lucrative. By loosening this constraint, Pragmatism rocketed into the American and international mainstream consciousness. Still, this small rider that would deliver it to the aristocracy would later sell it out to the vernacular shit-stack.</p><h3>Do you get your pleasure from truth or truth from pleasure?</h3><h4>James: Truth by Circumstantial Confidence</h4><p><em>The individual is at the center, surrounded by experientially contextualized truths.</em></p><p>According to James, ‘true’ is a term for <em>whatever </em>proves itself to be good in the way of belief and good for definite assignable reasons. It enables one to justify means if the ends are ‘virtuous’ and productive in improving one’s circumstances. This interpretation is <strong>selfish</strong>.</p><h4>Peirce: Truth by Probabilistic Confidence</h4><p><em>The truth is at the center, surrounded by different individuals’ experiences of it.</em></p><p>To get closer to the truth himself, Peirce — one of the <a href="http://en.wikipedia.org/wiki/Founders_of_statistics">founders of the field of statistics</a> — introduced the terms <strong>confidence</strong> and <strong>likelihood</strong> to the field. It is a <em>social</em> construct in universal terms. This interpretation is <strong>selfless</strong>.</p><p>This difference in formulation — boiling down to Peirce’s version of social as <em>universal</em>, whereas James’ version being scoped to a <em>special interest</em> — was so great in Peirce’s view that it later prompted him to coin a new term, <a href="http://en.wikipedia.org/wiki/Pragmaticism">Pragmaticism</a> (much less well-known, due to it being “too ugly to kidnap”), to differentiate his distinct conveyance.</p><h3>Straight Dope Pragmatism</h3><p>As a patron at a nice restaurant, it’s considered bad form to add spice to a dish before tasting it. So we have salt and pepper on the table (<a href="http://www.nytimes.com/roomfordebate/2013/09/10/should-salt-have-a-place-at-the-table/the-chef-knows-best-about-when-to-salt">usually</a>) to suit our taste, but it is considered good mannered to first try the dish as prepared before knowing how much, if any, of either is required.</p><p>Imagine a chef who prepares a dish for a customer. The customer then adds their own spices and gives the leftovers to their friend, who nukes it days later, adding Tabasco to make up for the freezer burn. Of course, everyone thought they were making the dish better by altering it, but — in the end — this dish does not represent the chef’s intention, and he shouldn’t get a bum rap if this hyper-spiced, soggy, scalding hot concoction burns your butthole.</p><p>Likewise, now consider a philosopher who — with meticulous detail — lays out his thoughtful discourse to a group of his peers. One of his peers adds his flavor to it and then gives you a taste. The point is before you judge the philosophy, try its original recipe.</p><h3>So What?</h3><p>So, if reality and truth are not absolute or definite but somewhat impacted by the perspectives of the individual, how are we supposed to know what we should do?</p><p>Even without absolute truth, there is a ‘mostly correct’ answer. That answer is the one ‘agreed upon by all who investigate.’ Peirce argues:</p><blockquote>The opinion which is fated to be ultimately agreed to by all who investigate, is what we mean by the truth, and the object represented in this opinion is the real.</blockquote><p>On that note:</p><ul><li><strong>Do your very best to gather </strong><a href="http://www.newyorker.com/news/news-desk/cleaning-up-science"><strong>clean data</strong></a><strong> and sound evidence.</strong></li><li><strong>Beware of counterfeit evidence</strong>: liars, counter-intelligent media/publications, propaganda (in all its fancy forms), flattery, advertisements, biased data, “fake news,” etc.</li><li><strong>If you hear a term that ends in “ism”, find out what it means before using it</strong>. This is not only sound advice about philosophical, but any terms.</li></ul><blockquote>Pragmatism is the most significant American contribution to philosophy.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed85f1e7a46b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are We Overpopulated?]]></title>
            <link>https://medium.com/@loganpowell/are-we-overpopulated-75f6513f398?source=rss-51406979288f------2</link>
            <guid isPermaLink="false">https://medium.com/p/75f6513f398</guid>
            <category><![CDATA[consumption]]></category>
            <category><![CDATA[evolution]]></category>
            <category><![CDATA[overpopulation]]></category>
            <category><![CDATA[nature]]></category>
            <category><![CDATA[sustainability]]></category>
            <dc:creator><![CDATA[Logan Powell]]></dc:creator>
            <pubDate>Thu, 18 Sep 2014 23:04:28 GMT</pubDate>
            <atom:updated>2022-10-31T01:35:20.579Z</atom:updated>
            <content:encoded><![CDATA[<p>Does nature have a preference for how many of her children turn out human?</p><h3>Our Incredible Growth</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b-Wp6LEfHn9IRSZu36-Y8Q.png" /><figcaption>Human population growth over the last 12,000 years, source: <a href="http://en.wikipedia.org/wiki/Population_growth">wikipedia.org</a></figcaption></figure><p>If we look at a graph of human population growth over the past few thousand years, it’s incredible. Our population has experienced an exponential, meteoric rise. <strong>The question we face here is whether or not this is a bad thing.</strong></p><p>Edward Abbey, in his book, “The Second Rape of the West” (p. 183) famously said:</p><blockquote>Growth for the sake of growth is the ideology of the cancer cell.</blockquote><p>But, the question in my mind is, is the cancer cell —being a natural flaw in our genetic material — bad? Granted, it might <em>feel </em>that way to its carrier, but how about in the eyes of nature? Not to be cheeky, but If you’re of the mind that a large population is a problem, then wouldn’t you consider cancer part of the <em>solution</em>?</p><h3><strong>A Grand Experiment</strong></h3><p>If there’s one thing that’s certain it’s that the world has been around far longer than we have and will go on far longer than we will. The Earth, oh rare and wonderful, has seen many species rise and fall. <strong>You might say that our planet has been <em>experimenting </em>with different forms of life</strong> since the serendipitous concoction (some even think <a href="http://www.smithsonianmag.com/science-nature/the-building-blocks-of-life-may-have-come-from-outer-space-3884354/?no-ist">inoculation</a>) of the first molecule of DNA. We might consider ourselves the newest in a long line of haphazard (sometimes diversifying other times variety-reducing) curation of life forms, all participating in the elusively patterned swirl of space, energy, and matter the best we can figure.</p><p>Beyond this, Earth is but one of innumerable other planets revolving around innumerable stars, dwelling in innumerable galaxies all containing the potential to house an innumerable number of forms of life. Is it unreasonable to assume that unknown life on those other planets would go through the same evolutionary experimentations as life on our little green rock? I mean, if there are sentient creatures who have somehow learned how to take advantage of nature the way we have (leveraging contrived technologies) wouldn’t they grow as we have, do as we have done?</p><p><strong>It seems to me that we have done what was inevitable given the environment we evolved within.</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FDIGeDAZ6-q4%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DDIGeDAZ6-q4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FDIGeDAZ6-q4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/add483ddce54a1089e395edf18697262/href">https://medium.com/media/add483ddce54a1089e395edf18697262/href</a></iframe><h3>‘The Purpose Driven Life’ Form</h3><p>There is no evidence that supports nature as having any destined purpose or ideal state that <em>we </em>are fucking up (pun intended). We are a part of nature and — therefore — our doings are natural. There has never been and never will be a time when there is a perfect amount of people or any other form of life. If there were such a thing as perfection, the universe would stop changing, having reached its desired state.</p><p>If no objective evidence attests to an ideal number for a population, there is thereby no way a population can be ‘over’ or ‘under’ it. It’s humans who have created these ideals and we do so with our own interests in mind. The question for us remains:</p><h2>What do we want nature to be?</h2><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*sjMPSbu_NELsjhMNbZEUlA.jpeg" /><figcaption><a href="https://www.flickr.com/photos/proudlove/">i</a>mage source: <a href="https://www.flickr.com/photos/proudlove/">https://www.flickr.com/photos/proudlove/</a></figcaption></figure><p>Many of our problems, pleasures, and strengths come from our inborn capacity to love. <a href="http://en.wikipedia.org/wiki/Charles_Sanders_Peirce">Charles Peirce</a>, the father of Pragmatism, wrote an out-of-character essay (he focused mostly on logic) entitled <a href="http://www.cspeirce.com/menu/library/bycsp/evolove/evolove.htm">Evolutionary Love</a> wherein he discusses the virtues of the type of love parents may have for offspring. The lesson <em>I </em>take from the work is that love is an evolutionary gift and the main reason we are so successful as a species.</p><h4>It is Love that Drives Population Growth</h4><p>We might consider love, like hands, or the brain, to be advantageous traits that have given us an edge over other species. Us humans have evolved to be endowed with this incredible power. A most provocative chemical system that motivates us to do such amazing things as communicate, build families and communities, help our neighbors, establish civilizations — ergo grow our population.</p><h3>Too Many or Too Much?</h3><p>I don’t think humans have taken over more than their ‘fair share’ of the Earth’s community. Even if it makes us uncomfortable, this is the way of nature.</p><p>However, though nature may not have an opinion as to whether or not we enjoy the world, <em>we do, </em>so <strong>let’s look at it from a </strong><a href="https://medium.com/@loganpowell/hedonism-youre-doing-it-wrong-8e5f09ed8a78"><strong>hedonist’s</strong></a><strong> perspective. </strong>If we <em>ourselves </em>desire to live in or leave a world to our children that is as fit for healthy living <em>as it was for us growing up</em>, we — the big, fat consumers of the world — might want to slow our roll a little.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*Onul2aL9nrI6TwvjUkGVDA.jpeg" /><figcaption>scene from <a href="http://en.wikipedia.org/wiki/They_Live">They Live</a></figcaption></figure><p>Nature ‘wants’ us to be happy. Happiness is inherently good, ‘<a href="https://medium.com/@loganpowell/hedonism-youre-doing-it-wrong-8e5f09ed8a78">endowed by our creator</a>’, the only caveat being that we are careful not to fall into the many trappings that lead us to mistake artificial substitutes for human happiness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lhhneB4OrgySB6N7R6EfEQ.png" /><figcaption><em>Image: “Ecological Footprint” source: </em><a href="http://www.worldmapper.org/display.php?selected=322"><em>http://www.worldmapper.org/</em></a></figcaption></figure><p>The warped world map above is what is called a density-equalized world map. This projection distributes the area of the geography in proportion to a metric. The metric displayed in this map is our ‘ecological footprint’. From the <a href="http://www.worldmapper.org/display.php?selected=322">source</a>:</p><blockquote>The ecological footprint is a measure of the area needed to support a population’s lifestyle. This includes the consumption of food, fuel, wood, and fibres. Pollution, such as carbon dioxide emissions, is also counted as part of the footprint.</blockquote><blockquote>… The per person footprint in the United States is almost five times the world average, and almost ten times what would be <a href="http://en.wikipedia.org/wiki/Sustainability">sustainable</a>.</blockquote><p>Over-consumption, more so than overpopulation, should be viewed as a threat to humans. Any discussion about overpopulation is incomplete without this dimension. It’s us (yes that means basically anyone reading this) who will swallow the planet if our appetites can’t be quenched.</p><p><strong>Final Food for Thought:</strong></p><ul><li><strong>Live well. </strong>Eat, drink and be merry, just don’t be a dick about it.</li><li><strong>Love well. </strong>If there be anything warranted as such, this is our destiny. If we can get the love thing down, all the rest will be marvelous for us.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75f6513f398" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>