<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Ben Kraft</title>
    <description></description>
    <link>http://www.benkraft.org/</link>
    <atom:link href="http://www.benkraft.org/feed/" rel="self" type="application/rss+xml" />
    <pubDate>Thu, 23 Oct 2025 02:03:09 +0000</pubDate>
    <lastBuildDate>Thu, 23 Oct 2025 02:03:09 +0000</lastBuildDate>
    <generator>Jekyll v3.10.0</generator>
    
      <item>
        <title>Fun With Pickles: A Pickle Quine</title>
        <description>&lt;p&gt;&lt;a href=&quot;https://docs.python.org/3/library/pickle.html&quot;&gt;Pickle&lt;/a&gt; is Python’s all-purpose serialization format.  &lt;a href=&quot;https://docs.python.org/3/library/pickle.html#what-can-be-pickled-and-unpickled&quot;&gt;Most Python objects&lt;/a&gt; can be serialized and deserialized automatically.  It’s a very convenient, albeit fragile and &lt;a href=&quot;https://www.python.org/dev/peps/pep-0307/#security-issues&quot;&gt;insecure&lt;/a&gt; way to store data, such as when caching.&lt;/p&gt;

&lt;p&gt;While pickle is designed to encode Python objects, it’s a quite flexible format: basically a tiny programming language.  This led me to the question: can one write a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quine_(computing)&quot;&gt;quine&lt;/a&gt; in pickle?  That is, we want to create a (byte-)string which, if read as a pickle, deserializes to itself:&lt;/p&gt;
&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;quine&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pickle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;loads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;quine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;In this post, we’ll construct such a pickle quine, and learn a bit about the internals of pickle along the way.&lt;/p&gt;

&lt;h2 id=&quot;the-pickle-virtual-machine&quot;&gt;The pickle virtual machine&lt;/h2&gt;

&lt;p&gt;Let’s take a look at a simple pickle: the tuple &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(1, b&apos;asdf&apos;)&lt;/code&gt;.&lt;sup id=&quot;fnref:bytestrings&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:bytestrings&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pickle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dumps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;asdf&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;protocol&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x80\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;K&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x01&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;C&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;asdfq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x01&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;A pickle file consists of a series of instructions, each consisting of an opcode and perhaps some arguments.  The opcodes are described in detail in the &lt;a href=&quot;https://github.com/python/cpython/blob/3.8/Lib/pickletools.py&quot;&gt;pickletools&lt;/a&gt; source.  Let’s take a look at our pickle, starting from the beginnning.&lt;/p&gt;

&lt;p&gt;The first byte of our pickle is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0x80&lt;/code&gt;, which is the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PROTO&lt;/code&gt; opcode: it says the next byte, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0x03&lt;/code&gt;, will tell us which pickle protocol we’re using (in this case version 3).&lt;sup id=&quot;fnref:version&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:version&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;  Next is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;K&lt;/code&gt; (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0x4b&lt;/code&gt;), or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BININT1&lt;/code&gt;.  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BININT1&lt;/code&gt; tells us that the next byte is a small integer, in this case &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0x01&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;What do we do with this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt;?  A pickle decoder keeps its work in a stack: when we read an opcode like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BININT1&lt;/code&gt;, we push its value onto the stack; other opcodes pop data off of the stack.  At the end of the processing, the value on the top of the stack is the value we’ll return.&lt;/p&gt;

&lt;p&gt;We can now continue on to the next opcode, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C&lt;/code&gt; (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0x43&lt;/code&gt;), which is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SHORT_BINBYTES&lt;/code&gt;.  As the name implies, this encodes a bytestring.  The argument is a single byte &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0x04&lt;/code&gt;, which tells us the string is the next four bytes (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;asdf&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Next, we get a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BINPUT&lt;/code&gt; opcode (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;q&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0x71&lt;/code&gt;, with argument &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0x00&lt;/code&gt;).  This doesn’t affect us just yet, so we’ll revisit it when we need it.&lt;/p&gt;

&lt;p&gt;Now our stack has two values, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;b&apos;asdf&apos;&lt;/code&gt; on top and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt; below it.  Our next opcode is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0x86&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TUPLE2&lt;/code&gt;, which says to take the top two values on the stack, and make them into a tuple, pushing it onto the stack.  (There are other opcodes for 0-, 1-, and 3-tuples; and a pair of opcodes &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MARK&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TUPLE&lt;/code&gt; that let us build arbitrary-length tuples, but we won’t need any of those today.)  Then we have another &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BINPUT&lt;/code&gt; with argument &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0x01&lt;/code&gt;, which we’ll again skip for now.  Finally, we see &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.&lt;/code&gt; (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0x2e&lt;/code&gt;) which is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;STOP&lt;/code&gt;: we’re done, and we’ll return the top value of the stack, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(1, b&apos;asdf&apos;)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The pickletools module will save us having to remember all those opcode numbers:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pickletools&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pickle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dumps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;asdf&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;protocol&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; \&lt;span class=&quot;n&quot;&gt;x80&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PROTO&lt;/span&gt;      &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
    &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;K&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BININT1&lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
    &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;C&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;SHORT_BINBYTES&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;asdf&apos;&lt;/span&gt;
   &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
   &lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; \&lt;span class=&quot;n&quot;&gt;x86&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TUPLE2&lt;/span&gt;
   &lt;span class=&quot;mi&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
   &lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;STOP&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The layout of this dump is similar to a disassembly: and indeed we can think of a pickle decoder as a simple virtual machine, which reads and executes instructions from the pickle file.&lt;/p&gt;

&lt;h2 id=&quot;a-few-more-opcodes&quot;&gt;A few more opcodes&lt;/h2&gt;

&lt;p&gt;Now that we know how a pickle decoder works, we can write the quine.  We’ll need to know about a few more opcodes to do so.&lt;/p&gt;

&lt;p&gt;The first is super simple: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NONE&lt;/code&gt; (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;N&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0x4e&lt;/code&gt;) pushes the value &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;None&lt;/code&gt; onto the stack.&lt;/p&gt;

&lt;p&gt;The next opcode, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GLOBAL&lt;/code&gt; (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0x63&lt;/code&gt;), is key to the pickle format: it says “look up the value from this module with this name”.  This is how pickle encodes top-level functions and classes.  The way it formats its argument is a bit of a relic of pickle’s original (version 0) text-based format: it has two arguments, each of which we read by looking up to the next newline.  We can see an example by pickling the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;list&lt;/code&gt; builtin:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pickle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dumps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;protocol&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x80\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;cbuiltins&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;After the version header, we have a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GLOBAL&lt;/code&gt; opcode (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c&lt;/code&gt;), then &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;builtins\nlist\n&lt;/code&gt;: so we look up &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;builtins.list&lt;/code&gt; and (again ignoring &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BINPUT&lt;/code&gt;) return it.&lt;/p&gt;

&lt;p&gt;Third, we’ll need &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;REDUCE&lt;/code&gt;.  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;REDUCE&lt;/code&gt; is used to construct classes&lt;sup id=&quot;fnref:classes&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:classes&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt; and in a few other cases.  It requires two things to be on the stack: on top, a tuple of arguments, and below it, a callable; it calls &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;callable(*arguments)&lt;/code&gt;.  This, plus &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TUPLE2&lt;/code&gt; lets us call a function with two arguments: we push the function onto the stack, followed by the two arguments, then call &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TUPLE2&lt;/code&gt; to make the arguments into a pair, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;REDUCE&lt;/code&gt; to call them.&lt;/p&gt;

&lt;p&gt;Finally, it’s time to revisit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BINPUT&lt;/code&gt;.  The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pickletools&lt;/code&gt; module tells us that this will “store the stack top into the memo”.  Up until now, we’ve been storing all our work on the stack; the memo is pickle’s other data structure.  It’s just a big map of integer to object; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BINPUT&lt;/code&gt; inserts into that map, using its argument as the key and the top of the stack as the value.  Its friend &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BINGET&lt;/code&gt; does the reverse: it uses its argument as a key, and pushes the value at that key onto the stack.  The memo is useful as an optimization – &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BINGET n&lt;/code&gt; lets us re-use the object that was on top of the stack when &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BINPUT n&lt;/code&gt; was called – and also allows us to pickle recursive objects.&lt;sup id=&quot;fnref:recursive&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:recursive&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;  As a simplification, the pickler adds most of the objects it creates to the memo, without knowing if they’ll actually be used, which is why the above example could simply ignore the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BINPUT&lt;/code&gt;s.&lt;/p&gt;

&lt;p&gt;As an aside: you now know all you need to write a Very Dangerous pickle that will execute arbitrary code; try it for yourself!  This is a great reminder to never depickle untrusted data.&lt;/p&gt;

&lt;h1 id=&quot;the-quine&quot;&gt;The quine&lt;/h1&gt;

&lt;p&gt;Our basic strategy will be a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quine_(computing)#Constructive_quines&quot;&gt;typical one&lt;/a&gt; for writing quines:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Write code to define a string containing the entire program except for the string itself.&lt;/li&gt;
  &lt;li&gt;Write code that takes that string, splices it into itself at the right point, and returns it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let’s walk through the pickle.  We’ll build it up as a series of bytestrings (opcodes and their arguments) which we’ll join together at the end.&lt;/p&gt;

&lt;p&gt;First, the version header:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;n&quot;&gt;PROTO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, we push the string; this will have some placeholders we’ll figure out later.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    SHORT_BINBYTES, &amp;lt;1-byte length of the string&amp;gt;, &amp;lt;the string&amp;gt;,
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, we have the string itself on the stack; we have to to construct the output we want, which is splicing that string into itself at index 4 (the number of bytes before where the string appears in the output pickle).  In Python, this is pretty simple: we just want&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;the_string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;# the part before where we splice
&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;the_string&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;# the string itself
&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;the_string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:])&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;# the rest of the string
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We just need to encode this in pickle.  For this, we’ll need to know how to write everything in terms of builtin functions: pickle has no &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PLUS&lt;/code&gt; opcode.  The &lt;a href=&quot;https://docs.python.org/3/library/operator.html&quot;&gt;operator&lt;/a&gt; module comes to the rescue: we can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;operator.add(a, b)&lt;/code&gt; for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a + b&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;operator.getitem(c, i)&lt;/code&gt; for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c[i]&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We do need one more trick here: we need to know how Python represents that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:4&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;4:&lt;/code&gt;.  The answer is the little-known builtin &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;slice&lt;/code&gt;: the syntax &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c[a:b]&lt;/code&gt; is just syntactic sugar for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c[slice(a, b)]&lt;/code&gt;.  (Omitted values are passed as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;None&lt;/code&gt;.)  So we can rewrite our code as&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;operator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;operator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;# the_string[:4]
&lt;/span&gt;            &lt;span class=&quot;n&quot;&gt;operator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getitem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;the_string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;slice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)),&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;the_string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;# the_string[4:]
&lt;/span&gt;        &lt;span class=&quot;n&quot;&gt;operator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getitem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;the_string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;slice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This will be easier to represent.  Back to constructing our pickle, we store the string in the memo (slot 0), since we’ll need it a few times.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, we load up each of the builtins we’ll need, putting them in the memo dict.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;n&quot;&gt;GLOBAL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;builtins&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;slice&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;# push slice builtin
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x01&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# store it in memo
&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;GLOBAL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;operator&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;getitem&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;# push operator.getitem
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x02&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# store it in memo
&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;GLOBAL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;operator&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;       &lt;span class=&quot;c1&quot;&gt;# push operator.add
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# store it in memo
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, we start computing what we need.  In each case, we’re going to follow the pattern we discussed above to call a function with two arguments, and we’ll put the result in the memo.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;code&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;push&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;code&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;push&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;first&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;argument&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;code&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;push&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;second&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;argument&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;TUPLE2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;REDUCE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;memo&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;slot&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;First, we build each slice:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x01&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# load slice
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;NONE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                             &lt;span class=&quot;c1&quot;&gt;# push None
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BININT1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                 &lt;span class=&quot;c1&quot;&gt;# push 4
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;TUPLE2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;REDUCE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                   &lt;span class=&quot;c1&quot;&gt;# call --&amp;gt; slice(None, 4)
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# store that in memo
&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x01&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# load slice again
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BININT1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                 &lt;span class=&quot;c1&quot;&gt;# push 4
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;NONE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                             &lt;span class=&quot;c1&quot;&gt;# push None
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;TUPLE2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;REDUCE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                   &lt;span class=&quot;c1&quot;&gt;# call --&amp;gt; slice(4, None)
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x05&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# store that in memo
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Next, we use those slices to do the getitem calls:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x02&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# load getitem
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# load the string
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# load slice(None, 4)
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;TUPLE2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;REDUCE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                   &lt;span class=&quot;c1&quot;&gt;# call --&amp;gt; string[:4]
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x06&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# store that in memo
&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x02&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# load getitem again
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# load the string again
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x05&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# load slice(4, None)
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;TUPLE2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;REDUCE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                   &lt;span class=&quot;c1&quot;&gt;# call --&amp;gt; string[4:]
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x07&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# store that in memo
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Finally, we call add to glue everything together:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# load operator.add
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x06&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# load string[:4]
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# load string
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;TUPLE2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;REDUCE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                   &lt;span class=&quot;c1&quot;&gt;# call
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x08&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# store that in memo
&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# load operator.add again
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x08&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# load string[:4] + string
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x07&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# load string[4:]
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;TUPLE2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;REDUCE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;                   &lt;span class=&quot;c1&quot;&gt;# call
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We’ve left the result on top of the stack, so a simple&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;n&quot;&gt;STOP&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;will finish things up.&lt;/p&gt;

&lt;p&gt;Except we’re not quite done: we have to fill in those placeholders.  The length will be the total number of opcodes we’ve printing above (counting itself, not counting the placeholder for the string), which in this case is 117.  And then we just have to substitute in the string.  This gives us the pickle:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;quine&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x80\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Cu&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x80\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Cuq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;cbuiltins&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;slice&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x01&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;coperator&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;getitem&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x02&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;coperator&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x01&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;NK&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x01&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;K&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x05&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x02&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x06&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x02&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x05\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x07&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x06&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x08&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x08&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x07\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;R.q&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;cbuiltins&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;slice&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x01&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;coperator&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;getitem&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x02&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;coperator&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x01&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;NK&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x01&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;K&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x05&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x02&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x06&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x02&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x05\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x07&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x06&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x08&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x08&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x07\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;R.&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;or run through &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pickletools.dis&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; \&lt;span class=&quot;n&quot;&gt;x80&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PROTO&lt;/span&gt;      &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
    &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;C&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;SHORT_BINBYTES&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x80\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Cuq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;cbuiltins&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;slice&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x01&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;coperator&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;getitem&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x02&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;coperator&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x01&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;NK&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x01&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;K&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x05&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x02&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x04\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x06&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x02&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x05\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x07&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x06&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x00\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Rq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x08&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x03&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x08&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\x07\x86&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;R.&apos;&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;121&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;123&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;GLOBAL&lt;/span&gt;     &lt;span class=&quot;s&quot;&gt;&apos;builtins slice&apos;&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;139&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;141&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;GLOBAL&lt;/span&gt;     &lt;span class=&quot;s&quot;&gt;&apos;operator getitem&apos;&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;159&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;161&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;GLOBAL&lt;/span&gt;     &lt;span class=&quot;s&quot;&gt;&apos;operator add&apos;&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;175&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;177&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;179&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;N&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;NONE&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;180&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;K&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BININT1&lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;182&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; \&lt;span class=&quot;n&quot;&gt;x86&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TUPLE2&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;183&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;R&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;REDUCE&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;184&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;186&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;188&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;K&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BININT1&lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;190&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;N&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;NONE&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;191&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; \&lt;span class=&quot;n&quot;&gt;x86&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TUPLE2&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;192&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;R&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;REDUCE&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;193&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;195&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;197&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;199&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;201&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; \&lt;span class=&quot;n&quot;&gt;x86&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TUPLE2&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;202&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;R&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;REDUCE&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;203&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;205&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;207&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;209&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;211&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; \&lt;span class=&quot;n&quot;&gt;x86&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TUPLE2&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;212&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;R&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;REDUCE&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;213&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;215&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;217&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;219&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;221&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; \&lt;span class=&quot;n&quot;&gt;x86&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TUPLE2&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;222&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;R&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;REDUCE&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;223&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINPUT&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;225&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;227&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;229&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;BINGET&lt;/span&gt;     &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;231&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; \&lt;span class=&quot;n&quot;&gt;x86&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TUPLE2&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;232&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;R&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;REDUCE&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;233&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;STOP&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And that, truly, is it!&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;assert quine == pickle.loads(quine)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you want to play with this further, I’ve posted &lt;a href=&quot;https://github.com/benjaminjkraft/pickle-junk/blob/master/pickle_quine.py&quot;&gt;the complete code&lt;/a&gt; to generate and check the pickle, as well as a version optimized to be as short as possible (suggestions welcome).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Thanks to Benjamin Tidor for comments on an earlier draft.&lt;/em&gt;&lt;/p&gt;
&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:bytestrings&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Throughout this post we’ll be using bytestrings, because that’s what we need for the quine.  Strings work roughly the same way. &lt;a href=&quot;#fnref:bytestrings&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:version&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;We’re using version 3 because it’s a little simpler than &lt;a href=&quot;https://www.python.org/dev/peps/pep-3154/&quot;&gt;version 4&lt;/a&gt;; handling framing wouldn’t complicate things much, but would add one more thing to explain. &lt;a href=&quot;#fnref:version&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:classes&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;There are a few different ways to construct classes; in modern pickle versions &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;REDUCE&lt;/code&gt; isn’t as common, but it’s still used in certain cases, and it’s the simplest and most flexible.  For the really curious, search for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;REDUCE&lt;/code&gt; or read &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;save_reduce&lt;/code&gt; in the &lt;a href=&quot;https://github.com/python/cpython/blob/3.7/Lib/pickle.py&quot;&gt;pickle source&lt;/a&gt;. &lt;a href=&quot;#fnref:classes&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:recursive&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Exercise to the reader: figure out why a memo-dict is so important to a recursive object.  Hint: think about what happens when you pickle the the value produced by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d = {}; d[&apos;self&apos;] = d&lt;/code&gt;. &lt;a href=&quot;#fnref:recursive&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Sun, 21 Mar 2021 00:00:00 +0000</pubDate>
        <link>http://www.benkraft.org/2021/03/21/pickle-quine/</link>
        <guid isPermaLink="true">http://www.benkraft.org/2021/03/21/pickle-quine/</guid>
        
        
      </item>
    
      <item>
        <title>Go Reflection in 10 Minutes</title>
        <description>&lt;p&gt;This is a quick explanation of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt; package in Go, originally written for some of my coworkers, because I find the official &lt;a href=&quot;https://blog.golang.org/laws-of-reflection&quot;&gt;introduction&lt;/a&gt; a bit convoluted. This post assumes that you already know the basics of Go, including the usage of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;interface{}&lt;/code&gt;, and understand why you might want reflection. And a reminder: anything you can do without &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt; is probably better done that way; and anything you can’t might be better not done at all.&lt;/p&gt;

&lt;h2 id=&quot;values-and-types&quot;&gt;Values and Types&lt;/h2&gt;

&lt;p&gt;There are two main types in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Value&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Type&lt;/code&gt;. These are fairly self-explanatory: they’re &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt;’s representation of Go’s values and types, and we can create them by calling &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect.ValueOf&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect.TypeOf&lt;/code&gt; on any Go value. Their methods are the bulk of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt; package. For example:&lt;/p&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;I&apos;m a string!&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sValue&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reflect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ValueOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sValue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;// 13&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;stringType&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reflect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TypeOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;// or sValue.Type()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;stringType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;// &quot;string&quot;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myStruct&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;struct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;foo&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;bool&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;reflect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ValueOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myStruct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;123&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Field&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;// reflect.ValueOf(123)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Most of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt; package is methods on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Type&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Value&lt;/code&gt;: for example for a map type one can get the key and value types; and for a map value one can ask for the keys as a slice of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect.Value&lt;/code&gt;.  (The &lt;a href=&quot;https://godoc.org/reflect&quot;&gt;documentation&lt;/a&gt;, of course, has the details.)&lt;/p&gt;

&lt;p&gt;To convert a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect.Value&lt;/code&gt; back to an ordinary Go value, one uses &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;value.Interface()&lt;/code&gt;; this returns an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;interface{}&lt;/code&gt; which the caller likely must cast to the expected type. (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt; provides helpers like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;value.String()&lt;/code&gt; to do this for common types.)&lt;/p&gt;

&lt;h2 id=&quot;kinds&quot;&gt;Kinds&lt;/h2&gt;

&lt;p&gt;The last important type in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt; is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Kind&lt;/code&gt;, which is used to tell which form of builtin a particular type is. (It’s unrelated to the type-theoretic notion of “kind”.) For example, a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Kind&lt;/code&gt; tells us if we have a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;map&lt;/code&gt; or a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;func&lt;/code&gt; or an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int&lt;/code&gt;, but not what the keys and values of the map are. It’s probably best explained by listing the enum values:&lt;/p&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;n&quot;&gt;Invalid&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Bool&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Int&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Int8&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Int16&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Int32&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Int64&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Uint&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Uint8&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Uint16&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Uint32&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Uint64&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Uintptr&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Float32&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Float64&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Complex64&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Complex128&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Array&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Chan&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Func&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Interface&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Map&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Ptr&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Slice&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Struct&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;UnsafePointer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Every &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect.Type&lt;/code&gt; fits into one of these, which we can check by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;type.Kind()&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;value.Kind()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Note that almost everything in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt; will panic if given invalid data. For example, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect.Value(123).Field(0)&lt;/code&gt; (getting a field on an int) will panic.&lt;/p&gt;

&lt;h2 id=&quot;what-can-it-do&quot;&gt;What can it do?&lt;/h2&gt;

&lt;p&gt;In general, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt; is designed so that you can with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt; exactly that which you can do in ordinary Go, just more generally. (There are a few exceptions, like defining methods.) For example, it can:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;index into a slice or map (of arbitrary element type) using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect.Value.Index&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect.Value.MapIndex&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;call a function (of arbitrary signature) using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect.Value.Call&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;create a channel (of arbitrary element type) using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect.MakeChan&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Values which can be set in ordinary Go can also be set with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt;; for example:&lt;/p&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reflect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ValueOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reflect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ValueOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;  &lt;span class=&quot;c&quot;&gt;// sets s[1] = 4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But values which are normally unsettable still are with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reflect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ValueOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reflect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ValueOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;  &lt;span class=&quot;c&quot;&gt;// panics: can&apos;t set a literal&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So you can’t use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt; to escape ordinary memory safety guarantees, for example, and access to unexported struct fields is limited.&lt;/p&gt;

&lt;h2 id=&quot;interfaces&quot;&gt;Interfaces&lt;/h2&gt;

&lt;p&gt;Interface types in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt; are a bit weird. Basically, for most purposes, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt; never looks at the interface, only at the underlying value, because all its constructors accept &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;interface{}&lt;/code&gt;. For example:&lt;/p&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Stringer&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;interface&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Foo&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;struct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;foo&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Foo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;it&apos;s a foo!&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Stringer&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Foo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;reflect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TypeOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;// Foo, not Stringer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It’s possible to get interface values in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt;, such as by looking at the element type of a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[]Stringer&lt;/code&gt;, but it’s uncommon.&lt;/p&gt;

&lt;h2 id=&quot;thats-it&quot;&gt;That’s it!&lt;/h2&gt;

&lt;p&gt;I hope this makes &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt; seem a bit less scary. While the code you write with it may be very abstract, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reflect&lt;/code&gt; itself isn’t too complicated. Use with care!&lt;/p&gt;
</description>
        <pubDate>Wed, 02 Oct 2019 00:00:00 +0000</pubDate>
        <link>http://www.benkraft.org/2019/10/02/go-reflection/</link>
        <guid isPermaLink="true">http://www.benkraft.org/2019/10/02/go-reflection/</guid>
        
        
      </item>
    
      <item>
        <title>Advent of Code in 25 Languages</title>
        <description>&lt;p&gt;This year, I did &lt;a href=&quot;https://adventofcode.com/&quot;&gt;Advent of Code&lt;/a&gt;’s 25 daily Christmas-themed programming puzzles, in a different language every day.  It was a lot of fun!  You can see my solutions &lt;a href=&quot;https://github.com/benjaminjkraft/aoc2017/&quot;&gt;on GitHub&lt;/a&gt;, or read on for (less spoilerful) thoughts on the languages I used.&lt;/p&gt;

&lt;p&gt;Without further ado, the languages:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;http://tldp.org/LDP/abs/html/&quot;&gt;Bash&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.jsoftware.com/&quot;&gt;J&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/C_(programming_language)&quot;&gt;C&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://people.eecs.berkeley.edu/~bh/docs/html/usermanual.html&quot;&gt;Logo (UCBLogo)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/C%2B%2B&quot;&gt;C++&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.oracle.com/javase/9/&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.perl.org/&quot;&gt;Perl 5&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.grymoire.com/Unix/Sed.html&quot;&gt;Sed&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://learnvimscriptthehardway.stevelosh.com/&quot;&gt;Vimscript&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://kotlinlang.org/&quot;&gt;Kotlin&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;(Google) Spreadsheet &lt;a href=&quot;https://support.google.com/docs/table/25273?hl=en&quot;&gt;formulas&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.scala-lang.org/&quot;&gt;Scala&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://clojure.org/&quot;&gt;Clojure&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://ocaml.org/&quot;&gt;OCaml&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://factorcode.org/&quot;&gt;Factor&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.r-project.org/&quot;&gt;R&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://crystal-lang.org/&quot;&gt;Crystal&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://secure.php.net/&quot;&gt;PHP&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://golang.org/&quot;&gt;Go&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.rust-lang.org/en-US/&quot;&gt;Rust&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.haskell.org/&quot;&gt;Haskell&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.ruby-lang.org/en/&quot;&gt;Ruby&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Pencil and paper and a bit of &lt;a href=&quot;https://www.wolfram.com/mathematica/&quot;&gt;Mathematica&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.destroyallsoftware.com/talks/wat&quot;&gt;JavaScript (ES6ish)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.python.org/&quot;&gt;Python 3&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;general-thoughts&quot;&gt;General thoughts&lt;/h2&gt;

&lt;p&gt;Trying out a lot of languages quickly was a lot of fun!  I didn’t really &lt;em&gt;learn&lt;/em&gt; the languages I didn’t already know, but I at least got a quick feel for most of them.  And it reminded me of just how much fun using different tools can be – I had a blast with Clojure despite little desire to use it for large, serious projects.&lt;/p&gt;

&lt;p&gt;Seeing so many languages so fast was a great reminder of just what is out there beyond the languages I use or even would seriously consider using for work.  And those differences aren’t just between the typical categories of functional and imperative, or higher and lower level.  In some of those cases you can see the flow of ideas – from Python to Go, for example.  And some ideas have come in over time – the default semantics around imports and namespacing seems to be a great way to date a language, in that Clojure has more in common with Python than with almost any other functional language.&lt;/p&gt;

&lt;p&gt;The role of language &lt;em&gt;design&lt;/em&gt; in how a language feels was also clear.  I found the cleanly designed languages – Clojure, Go, and Python most clearly, and to a lesser extent Kotlin, Ruby/Crystal, and Rust – a lot easier and more fun to use than their less consistent counterparts like OCaml, R, and PHP.  Just having consistent APIs, whether formally as interfaces/typeclasses/overloading or just simply as consistently laid-out modules, is a huge first step.&lt;/p&gt;

&lt;p&gt;I don’t think I’ll do it again – suggestions welcome for next year’s Fun Constraint – but it was definitely a lot of fun.&lt;/p&gt;

&lt;h2 id=&quot;sed&quot;&gt;Sed&lt;/h2&gt;

&lt;p&gt;Ok, let’s get it out of the way.  I did &lt;a href=&quot;https://github.com/benjaminjkraft/aoc2017/blob/master/day08.sed&quot;&gt;day 8&lt;/a&gt; using only &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed&lt;/code&gt;.  Not shell scripting and grep and other utils – that was &lt;a href=&quot;https://github.com/benjaminjkraft/aoc2017/blob/master/day01.sh&quot;&gt;day 1&lt;/a&gt; – but rather a single sed script, run with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#!/bin/sed -nf&lt;/code&gt; which output the answers.&lt;/p&gt;

&lt;p&gt;The first thing to know is that yes, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed&lt;/code&gt; is easily Turing-complete: it has &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GOTO&lt;/code&gt;&lt;sup id=&quot;fnref:goto&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:goto&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;if&lt;/code&gt;&lt;sup id=&quot;fnref:if&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:if&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;, and of course &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s&lt;/code&gt;&lt;sup id=&quot;fnref:s&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:s&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;, and you’re off to the races.  There’s a nice &lt;a href=&quot;http://www.catonmat.net/blog/proof-that-sed-is-turing-complete/&quot;&gt;blog post&lt;/a&gt; with a more formal proof, and &lt;a href=&quot;https://github.com/stedolan/bf.sed&quot;&gt;several&lt;/a&gt; &lt;a href=&quot;https://github.com/svbatalov/bf.sed&quot;&gt;BF&lt;/a&gt; &lt;a href=&quot;https://github.com/izabera/bfsed&quot;&gt;interpreters&lt;/a&gt; for a more hands-on proof.&lt;/p&gt;

&lt;p&gt;But as anyone who’s tried to write a turing machine by hand knows, Turing-complete doesn’t mean practical.  The first problem, in this case, is that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed&lt;/code&gt; doesn’t have any arithmetic built in.  I ended up working in unary, using tally marks, so &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;||||&lt;/code&gt; is \(4\), and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-----&lt;/code&gt; is \(-5\).  (Converting to and from the decimal inputs is left as an exercise to the reader, or you can find it at the &lt;a href=&quot;https://github.com/benjaminjkraft/aoc2017/blob/master/day08.sed#L24&quot;&gt;start&lt;/a&gt; and &lt;a href=&quot;https://github.com/benjaminjkraft/aoc2017/blob/master/day08.sed#L174&quot;&gt;end&lt;/a&gt; of my solution.)  In hindsight, I think the slightly greater effort involved in implementing (much faster) decimal arithmetic might have been worthwhile, but that will have to wait for a future project.&lt;/p&gt;

&lt;p&gt;The second problem is that it’s pretty slow – you have only two string buffers (the pattern space and the hold space) and nearly anything you do will scan one of them.&lt;sup id=&quot;fnref:scan&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:scan&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;  When you’re representing a few dozen 4-digit numbers in unary, this gets slow fast.  The first two problems I tried to do were easier to implement, but just too slow to run.  &lt;a href=&quot;https://github.com/benjaminjkraft/aoc2017/blob/master/incomplete_day05.sed&quot;&gt;Day 5&lt;/a&gt; required jumping a certain number of lines ahead or behind, which I had to do by moving my marker one line at a time, scanning the buffer each time.  &lt;a href=&quot;https://github.com/benjaminjkraft/aoc2017/blob/master/incomplete_day06.sed&quot;&gt;Day 6&lt;/a&gt; required checking if the newly added line was unique, and \(O\!\left(n^2\right)\) scans of the (length \(n\)) buffer were just too slow.  (It’s possible by keeping the history sorted I could have done it; I didn’t try.)  Finally, Day 8, with a somewhat smaller working set and a totally linear flow, worked; it took half an hour or so to run but that was okay with me.&lt;/p&gt;

&lt;p&gt;I could probably write a full blog post on some of the tricks involved; you’ll just have to look at the source.  Plus, Bruce Barnett’s &lt;a href=&quot;http://www.grymoire.com/Unix/Sed.html&quot;&gt;Sed Grymoire&lt;/a&gt;, which I used as a reference, gives a much better explanation of the language as a whole than I ever could.&lt;/p&gt;

&lt;h2 id=&quot;the-weird-languages&quot;&gt;The “weird” languages&lt;/h2&gt;

&lt;p&gt;I used several other esoteric or special-purpose languages, which were a lot of fun.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/benjaminjkraft/aoc2017/blob/master/day02.j&quot;&gt;Day 2&lt;/a&gt; was in J – a whole 50 characters not counting input and comments.  I’ve used J for some Project Euler problems before.  It has a much deserved reputation for inscrutability due to the 1- and 2-character identifiers, but once you get beyond that, it’s actually a pretty interesting language: it’s array-focused (so &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;map&lt;/code&gt; is often implicit: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1 + 1 2 3&lt;/code&gt; evaluates to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2 3 4&lt;/code&gt;), and has an unusual grammar where higher-order functions are “adverbs” that modify other functions (“verbs”).  I’d love to see a less terse language in this style; the only similar ones I’ve used are Mathematica and R, and they still have normal grammars.  Anyway, J is just too hard to read for general use but it’s worth playing around with.&lt;/p&gt;

&lt;p&gt;I went back to 4th grade a bit with Logo (yeah, the one with the turtle) on &lt;a href=&quot;https://github.com/benjaminjkraft/aoc2017/blob/master/day04.logo&quot;&gt;Day 4&lt;/a&gt;.  It’s very primitive – input reading was a huge pain – and has some strange syntax, but in some ways it’s surprisingly modern; you can see the Lisp influence really clearly.  The builtins and syntax are just too primitive for serious work, though.&lt;/p&gt;

&lt;p&gt;As a Vim user I felt obligated to give Vimscript a try for &lt;a href=&quot;https://github.com/benjaminjkraft/aoc2017/blob/master/day09.vim&quot;&gt;Day 9&lt;/a&gt;.  I expected it to be another painful special-purpose language missing normal functionality, but it turns out it’s actually a very reasonable scripting language, in the general flavor of Python or Ruby, albeit with a couple of quirks.  This was actually one of the simplest solutions I wrote.&lt;/p&gt;

&lt;p&gt;Spreadsheet formulas, like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed&lt;/code&gt;, took me a few tries because I had to find a suitable problem to avoid crashing my spreadsheet program, but &lt;a href=&quot;https://docs.google.com/spreadsheets/d/1Stxs80LtqSoXDHMxUpyu_kf0ny8xyZMpL8jdlx5O2zQ/edit&quot;&gt;Day 11&lt;/a&gt; was perfect for it: the number of steps was manageable, and the logic was simple once you figured out how to represent the hex grid.&lt;/p&gt;

&lt;p&gt;Knowing &lt;a href=&quot;https://bitquabit.com/&quot;&gt;Benjamin Pollack&lt;/a&gt; meant I had to give Factor a try on &lt;a href=&quot;https://github.com/benjaminjkraft/aoc2017/blob/master/day15.factor&quot;&gt;Day 15&lt;/a&gt;.  Since the problem involved a fairly linear iteration, I had no trouble handling the stack.  The number of different shuffle words and combinators involved in the average script is a bit much, though – it seems like there are some conventions that would help but I haven’t really caught on to those yet.  I almost think I’d love to embed it in a more normal language, so you can use traditional syntax to more conveniently express the overall control flow, but have the stack syntax to write the computations, or something.&lt;/p&gt;

&lt;p&gt;And finally, just when I was a little worried I was coming up short a language or two, &lt;a href=&quot;https://github.com/benjaminjkraft/aoc2017/blob/master/day23.txt&quot;&gt;Day 23&lt;/a&gt; was a great problem to do mostly by hand.  I was a little miffed that I did have to resort to real code to compute the final result, but Mathematica did that just fine.&lt;/p&gt;

&lt;h2 id=&quot;c-c-go-and-rust&quot;&gt;C, C++, Go, and Rust&lt;/h2&gt;

&lt;p&gt;I don’t do much lower-level programming, so languages like C, C++, Go, and Rust were a mostly new adventure for me.  Luckily, the problem I chose to do in C was simple enough that I didn’t really have to think about pointers; in C++ I had to pass a few things around but didn’t really have to worry about managing memory carefully.&lt;/p&gt;

&lt;p&gt;I found both Go and Rust really interesting; I hear them get compared a lot, but they take very different approaches and feel very different for it.  I used Go first; it felt, to me, like a slightly lower-level Python.  I didn’t use all the language features but I had no trouble wrapping my head around the basics quickly; I feel like I could be writing good quality real code in Go within a week.  The explicit error-checking gets a little annoying, but having automatic memory management and modern build tools, even without many other modern features, was enough to make it feel plenty usable while remaining a super simple language.  Meanwhile, Rust was the opposite: it felt very cutting-edge, but I had a lot of trouble wrapping my head around it.  I didn’t really make sense of all the different behaviors of the borrow checker, and the differences between different types of references, and so on.  Once you get past those, on the other hand, it’s a very full-featured functional language that just happens to give you very low-level capabilities.  Anyway, the two of those make me excited for the future of programming languages.&lt;/p&gt;

&lt;h2 id=&quot;what-i-didnt-like&quot;&gt;What I didn’t like&lt;/h2&gt;

&lt;p&gt;Lastly, a few languages I just didn’t like.&lt;/p&gt;

&lt;p&gt;I found Perl the hardest to understand of any of the general-purpose languages I tried.  There’s so much magic: the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$&lt;/code&gt; vs. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@&lt;/code&gt; vs. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;%&lt;/code&gt; for variables (and the casts those do), for example.  It felt like someone took PHP – which I actually found surprisingly reasonable, if a bit antiquated – and tried to make it much more difficult to understand without adding much useful functionality (as far as I saw).  So, it keepts its place in string-processing one-liners, but I think I’ll leave it there.&lt;/p&gt;

&lt;p&gt;Scala I managed to get in dependency hell without installing any dependencies – it didn’t like my JDK 9, and so I installed JDK 8 and it still didn’t like that, so I got a standalone install of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sbt&lt;/code&gt; build toolchain, but I couldn’t really figure how to get that to pass stdin to my executable, so I ended up with a somewhat messy and inconsistent workflow.  I’m sure it’s a fine language once you install it correctly, although from my limited use it didn’t feel as nice as Kotlin.&lt;/p&gt;

&lt;p&gt;OCaml I found nearly unusable.  The standard library is really simple, and apparently everybody uses one of several alternative ones, which I didn’t realize until I was done.  But even beyond the weak standard library, it really felt like it’s been superseded by more modern functional languages like Haskell.&lt;/p&gt;

&lt;p&gt;The only two languages I seriously tried at and didn’t end up using were assembly and Erlang.  Assembly I gave up on as soon as I realized I would need a nontrivial data structure for the problem.  The combination of strange syntax and different programming model of Erlang were just too much.  I had used Erlang before and found it fine, but by the time I finished parsing the input I wasn’t really excited to continue, and I ended up doing the problem in Ruby.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:goto&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;b label&lt;/code&gt; jumps to an earlier &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:label&lt;/code&gt;. &lt;a href=&quot;#fnref:goto&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:if&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/foo/ { ... }&lt;/code&gt; executes the commands in the braces only if the regex &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;foo&lt;/code&gt; matches. &lt;a href=&quot;#fnref:if&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:s&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s/foo/bar/g&lt;/code&gt; replaces all the occurrences of the regex &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;foo&lt;/code&gt; with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bar&lt;/code&gt;.  Of course, with backreferences, this is much more powerful than your &lt;a href=&quot;https://en.wikipedia.org/wiki/Regular_expression#Expressive_power_and_compactness&quot;&gt;theory&lt;/a&gt; might lead you to expect. &lt;a href=&quot;#fnref:s&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:scan&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;An &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s&lt;/code&gt; without the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g&lt;/code&gt; or a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/pattern/&lt;/code&gt; that successfully matches will only scan as far as necessary, but that’s not much better in many cases. &lt;a href=&quot;#fnref:scan&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Tue, 26 Dec 2017 00:00:00 +0000</pubDate>
        <link>http://www.benkraft.org/2017/12/26/advent-of-code/</link>
        <guid isPermaLink="true">http://www.benkraft.org/2017/12/26/advent-of-code/</guid>
        
        
      </item>
    
      <item>
        <title>How I Teach Gerrymandering, v2</title>
        <description>&lt;p&gt;I &lt;a href=&quot;http://mitesp.tumblr.com/post/130793404248/how-i-teach-gerrymandering&quot;&gt;wrote&lt;/a&gt; last year about how I’ve taught gerrymandering to students at Splash, and why.  It’s been a year, I’ve made a number of updates to the class, and gerrymandering is back in the news, so it seems time for some updates.  Below, find &lt;a href=&quot;#changes&quot;&gt;the changes I’ve made&lt;/a&gt;, &lt;a href=&quot;#maps&quot;&gt;editable versions of the maps to use yourself&lt;/a&gt;, and &lt;a href=&quot;#next&quot;&gt;what’s next&lt;/a&gt;.  Most of this will make more sense if you’ve read my &lt;a href=&quot;http://mitesp.tumblr.com/post/130793404248/how-i-teach-gerrymandering&quot;&gt;previous post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;changes&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;changes-ive-made&quot;&gt;Changes I’ve made&lt;/h2&gt;

&lt;p&gt;As you’ll see below, the most obvious change I’ve made is to use smaller maps.  It’s a little harder to fit exactly the phenomena I want into them, but it means students spend a &lt;em&gt;lot&lt;/em&gt; less time counting up districts and hopefully some more time thinking about the underlying ideas.  Using the same map (even with the same dots on it) for all the variations also removes another little bit of cognitive overhead – it’s always the same 30 precincts, 6 districts, and same geographic pattern, like so:&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;half-width&quot; src=&quot;/files/gerrymandering-1.png&quot; alt=&quot;Map of Splashland with grey dots and no lines&quot; /&gt;
&lt;img class=&quot;half-width&quot; src=&quot;/files/gerrymandering-2.png&quot; alt=&quot;Map of Splashland with blue and red dots and stars and a grid&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In the time I save from the smaller maps, I’ve added a map where the students try to draw the fairest maps they can.  (It’s actually the same as the first map where they’re drawing a biased map.)  This has had interesting results – usually some people go for all competitive districts, while others don’t pay as much attention to that and think about other factors.&lt;/p&gt;

&lt;p&gt;When we discuss real maps at the end, I’ve made a stronger attempt to tie them directly to themes we’ve discussed, and pick maps that are apropos or that I can talk a bit more about.  So I point to majority-minority districts in North Carolina, districts in Florida that figured in court battles there, and of course Arizona and its independent commission.  Since I see this as one of the most important parts of the class there’s still a lot more I want to do here.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;maps&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;maps-to-use&quot;&gt;Maps to use&lt;/h2&gt;

&lt;p&gt;I’ve received several requests from friends to use the maps themselves, so I figured I’d &lt;a href=&quot;https://github.com/benjaminjkraft/gerrymandering-maps&quot;&gt;put them up on GitHub&lt;/a&gt;.  They’ll make the most sense if you’ve seen me teach the class, but I’ve also included my own notes from teaching as a reference, and some pointers in the README.  You can download the entire set &lt;a href=&quot;https://github.com/benjaminjkraft/gerrymandering-maps/releases/download/2.1.0/gerrymandering-maps-2.1.0.zip&quot;&gt;here&lt;/a&gt; or see the source on &lt;a href=&quot;https://github.com/benjaminjkraft/gerrymandering-maps&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;next&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;

&lt;p&gt;This class is still a work in progress, of course.  I’d like to figure out how to get students to think a bit more about the meaning of representation in the first two maps, and try to seed more discussion there, rather than just having them draw some districts and sometimes not have too much to say about them other than “well I put the city together”.  I’d like to continue to better tie in real maps to the themes in the class.  And I’m considering extending the class, so we can actually spend time on factors like race and incumbency, and talk more at the end about real-world implications and possible reforms and add some more discussion digging into metrics like seats/votes curves and compactness.&lt;/p&gt;

&lt;p&gt;I’d also like to build a web version of the maps.  I’m hoping that technology could save even more of the time we spend counting, while allowing students to look at a lot more fun metrics, computed automatically.  And of course, then I might be able to share a bit more of the class with people who aren’t Splash students!  Stay tuned.&lt;/p&gt;
</description>
        <pubDate>Sat, 17 Dec 2016 00:00:00 +0000</pubDate>
        <link>http://www.benkraft.org/2016/12/17/gerrymandering-2/</link>
        <guid isPermaLink="true">http://www.benkraft.org/2016/12/17/gerrymandering-2/</guid>
        
        
      </item>
    
      <item>
        <title>The Federalist Papers</title>
        <description>&lt;p&gt;So I read the &lt;a href=&quot;https://en.wikipedia.org/wiki/Federalist_papers&quot;&gt;Federalist Papers&lt;/a&gt;.&lt;sup id=&quot;fnref:hamilton&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:hamilton&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;It was an interesting exercise!  While they aren’t the easiest reading, they’re still plenty comprehensible.  Even if you don’t want to read the entire set (perhaps just a few at a time over several months as I did), the first fourteen are some of the best and give the flavor of the whole.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;In this election cycle it’s oddly comforting to know that name-calling and intention-questioning isn’t new in our politics; Hamilton especially spills impressively much ink attacking the character of his opponents.  From No. 67 (“The Executive Department”) we have&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Here the writers against the Constitution seem to have taken pains to signalize their talent of misrepresentation. Calculating upon the aversion of the people to monarchy, they have endeavored to enlist all their jealousies and apprehensions in opposition to the intended President of the United States.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Hamilton would have us believe that the opponents of the constitution were reasonable people being corrupted and confused by a few malicious actors bent on destroying America.  If only Trump were so grandiloquent.&lt;/p&gt;

&lt;p&gt;The low blows aren’t the only parts of the Federalist Papers still apropos today.  The discussion of the interactions between the federal and state governments in No. 46 (“The Influence of the State and Federal Governments Compared”) at times seems very dated, but sections like&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;On the other hand, should an unwarrantable measure of the federal government be unpopular in particular States, […] the means of opposition to it are powerful and at hand. The disquietude of the people; their repugnance and, perhaps, refusal to co-operate with the officers of the Union; […] would form, in a large State, very serious impediments&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;sound familiar as the federal government spars with the states over the legalization of marijuana.  Some things, on the other hand, have gone in a totally different direction over the last hundred years: No. 68 (“The Mode of Electing the President”) defends the electoral college as if it were the most obvious and normal thing in the world, and No. 76 (“The Appointing Power of the Executive”) contains the choice quote&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;It is also not very probable that [the President’s] nomination would often be overruled [by the Senate].&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;p&gt;The most interesting thing I got out of this project was the idealism the authors had for their new nation.  In between spending pages discussing the meaning of a clause and the problems in the Articles of Confederation, Hamilton, Jay, and most eloquently Madison can’t help but wax poetic on their optimism for this American experiment.  Hamilton opens No. 1 (“General Introduction”) by laying the stakes, as he sees them, on the table:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;It has been frequently remarked that it seems to have been reserved to the people of this country, by their conduct and example, to decide the important question, whether societies of men are really capable or not of establishing good government from reflection and choice, or whether they are forever destined to depend for their political constitutions on accident and force.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A bit Amerocentric, sure, but it makes us step back a moment.  The authors really believe that their experiment is a new one, with no equal in history to date, and that what they are doing will affect the course of history.  The example from which they draw the most is, of all things, the British government and constitution, the exact structure against which they rebelled; they also mention many other examples, none quite the same as what they seek to build.  Sometimes one gets the impression they thought their document would be lucky to last few decades – not unreasonable given that its predecessor lasted just 8 years.  It’s not clear every clause was considered quite as carefully as we might like to believe; certainly the founders didn’t know as much as we do about political science.  Yet here we are today, with barely an amendment each decade, let alone a full rewrite.&lt;/p&gt;

&lt;p&gt;And so some of these monologues are just a joy to read.  The last paragraph of No. 14 (“Objections to the Proposed Constitution From Extent of Territory Answered”) is as much a paean to the United States as it is an answer to an objection to the Constitution:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Is it not the glory of the people of America, that, whilst they have paid a decent regard to the opinions of former times and other nations, they have not suffered a blind veneration for antiquity, for custom, or for names, to overrule the suggestions of their own good sense, the knowledge of their own situation, and the lessons of their own experience? […] Had no important step been taken by the leaders of the Revolution for which a precedent could not be discovered, […] the people of the United States […] must at best have been laboring under the weight of some of those forms which have crushed the liberties of the rest of mankind. Happily for America, happily, we trust, for the whole human race, they pursued a new and more noble course. They accomplished a revolution which has no parallel in the annals of human society. They reared the fabrics of governments which have no model on the face of the globe. They formed the design of a great Confederacy, which it is incumbent on their successors to improve and perpetuate.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here’s to improving and perpetuating it.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:hamilton&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;This all started from some iteration of listening to the Hamilton soundtrack. &lt;a href=&quot;#fnref:hamilton&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Sun, 26 Jun 2016 00:00:00 +0000</pubDate>
        <link>http://www.benkraft.org/2016/06/26/federalist-papers/</link>
        <guid isPermaLink="true">http://www.benkraft.org/2016/06/26/federalist-papers/</guid>
        
        
      </item>
    
      <item>
        <title>What Did I Learn as an Undergrad?</title>
        <description>&lt;p&gt;At some point around graduation last year, a friend asked me what I had learned in the past four years.  I don’t remember what I said at the time, other than that it was surely haphazard and incomplete, but the question kept kicking around in my head.  So, a whole year later, as it turns out, here is a perhaps fuller, if necessarily still incomplete, answer to that question.&lt;/p&gt;

&lt;h2 id=&quot;on-abstraction&quot;&gt;On abstraction&lt;/h2&gt;

&lt;p&gt;Being a math major at MIT, I of course learned some math.  I see math as the study of abstraction and abstract structure, and I learned plenty about both – especially from the perspective of algebraic topology and related fields, but also as they pertain to other fields of math, physics, and computer science.  (It turns out that many of the fields that interest me have abstraction as a core idea.)&lt;/p&gt;

&lt;p&gt;I’ve learned that maintaining these abstractions in one’s head is hard.  By the time you’re thinking about something like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Steenrod_algebra&quot;&gt;Steenrod Algebra&lt;/a&gt; everything you do relates to reality only through at least five&lt;sup id=&quot;fnref:layers&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:layers&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; layers of abstraction.  The value of the abstraction is of course that you don’t have to think about the whole stack most of the time, when you’re just doing some algebraic computation.  But to put things together, you have to load it all back into your head, and I learned how hard that is.&lt;/p&gt;

&lt;p&gt;We need better ways of thinking about these abstractions, in math but also in physics, computer science, and probably elsewhere, too, because the difficulty of maintaining abstractions prevents us from building better ones that can do more for us.  I’ve learned that web development, for instance, is surprisingly time-consuming even for experienced developers; there’s just a lot of code to write for everything one does.  We need to be working at a much higher level – not just a slightly more powerful programming language or framework, but something really new.  But it’s not at all clear how one gets there without collapsing under the weight of the abstractions.  In any case, I digress – something I definitely already knew how to do more than four years ago.&lt;/p&gt;

&lt;h2 id=&quot;on-symmetry&quot;&gt;On symmetry&lt;/h2&gt;

&lt;p&gt;On a more specific note, perhaps the single most interesting vaguely academic thing I learned about probably wasn’t in math classes at all: it was the idea of gauge symmetry in physics.  Lie groups keep popping up as motivation everywhere in physics and math, and their particular application in quantum field theory results in a really incredible theory of the universe with surprisingly few arbitrary choices.  Gauge symmetry, among other things, caused me to realize what I wish I had known earlier: that the applications of math can be really interesting in their own right.&lt;/p&gt;

&lt;p&gt;Even classical field theory, as simplified as it is, is already a beautiful way of thinking about things, and quantum field theory is even better with the added benefit that it appears to actually describe our universe with unparalleled accuracy.  Unfortunately it’s at the top of a mountain of physics and math, and even giving a real flavor for it without a lot of background is difficult.  But I learned a lot on the parts of that mountain that I climbed.&lt;/p&gt;

&lt;h2 id=&quot;on-knowledge-transfer&quot;&gt;On knowledge transfer&lt;/h2&gt;

&lt;p&gt;From my &lt;span title=&quot;Say it with me, class…&quot;&gt;first evening&lt;/span&gt; at MIT, I began to learn the MIT oral history – the stories of hackers past, the escapades of student groups, and the origin of dorm traditions.  And they are really an oral history&lt;sup id=&quot;fnref:bexley&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:bexley&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;: they come with their heroes’ journeys, their tired tropes, and their cultural wisdom.  The four-year memory of undergraduates makes passing on knowledge and values a constant concern for student groups and dorms, and I learned a lot about that.&lt;/p&gt;

&lt;p&gt;As chair of &lt;a href=&quot;https://esp.mit.edu&quot;&gt;MIT ESP&lt;/a&gt; and in various other positions, I learned a fair amount about the mechanics of knowledge transfer.  I learned that it’s harder than it seems: there are any number of reasons to decide not to pass something on: that it won’t actually be that useful, that it’s just your opinion, that things will change anyway; and there are just as many ways to pass on knowledge that isn’t actually useful.  But I also learned that the harder thing, and the arguably more important one, is values transfer.  Passing on knowledge is hard, but it’s doable, and it’s not like I’m now completely off the grid if someone has a question.  But passing on values is a lot harder, and something at which I wasn’t nearly as successful as I would have liked to be.&lt;/p&gt;

&lt;p&gt;ESP certainly continues to care about its core mission, but with other values and other organizations it’s less clear: will ESP continue to fight the battle for student independence, even when it makes some enemies and conflicts with other goals?  Will my floor, Bonfire, continue to collectively value leadership in the same way?  Will the &lt;a href=&quot;http://web.mit.edu/asa&quot;&gt;ASA&lt;/a&gt; continue to understand just what it means to &lt;a href=&quot;http://web.mit.edu/asa/rules/pdf/ASA-Operating-Guidelines.pdf&quot;&gt;say&lt;/a&gt; that “it is the highest responsibility of the [ASA] to act in the best interest of the MIT Community and of the Student Activities which it represents”? And is it even right for any of those organizations to carry on &lt;em&gt;my&lt;/em&gt; values, as new members come in with their own expectations and ideals?&lt;/p&gt;

&lt;p&gt;In the midst of that difficulty, I’ve learned the value of trivial traditions, and of the physical objects we leave behind: the party theme that recurs every year without fail, the furniture and kitchen implements that get passed down over the years, the murals that date back to time immemorial.  Perhaps it’s silly, but the fact that the chair that &lt;a href=&quot;http://www.pkoms.com&quot;&gt;pkoms&lt;/a&gt; bequeathed to Bonfire or the fancy printers that I convinced ESP to buy are still around holds some strange measure of meaning to me.&lt;/p&gt;

&lt;h2 id=&quot;on-people&quot;&gt;On people&lt;/h2&gt;

&lt;p&gt;I learned that people are messy, but totally worth it.  In political science classes I learned about the ridiculous factors like &lt;a href=&quot;http://www.vanderbilt.edu/csdi/research/CSDI_WP_05-2013.pdf&quot;&gt;shark attacks&lt;/a&gt; that affect how people vote.  But I also learned how in spite of the ignorance of the average American, voters’ choices are often &lt;a href=&quot;http://citizensurveyproject.com/_pdfs/Constituent-Responses-to-Roll-Call-Voting.pdf&quot;&gt;better-informed&lt;/a&gt; than one might expect.  In learning about all of the ways in which our democracy doesn’t function, what I found most impressive were the ways in which it &lt;em&gt;does&lt;/em&gt; function.&lt;/p&gt;

&lt;p&gt;I learned a lot about organizations, and about how people function in them – both small organizations like ESP, and large organizations like MIT.  As chair of ESP, I learned about the mechanics of managing an organization: running discussions, building consensus, making policy, overseeing people, and so on.  And by paying attention to student politics and sitting on various student and faculty committees I learned about how amazingly complicated large organizations can and perhaps need to be.&lt;/p&gt;

&lt;p&gt;And I learned a lot about social dynamics and how people interact informally.  I learned that small social groups are wonderfully rewarding but also incredibly complicated, that telling someone they’re welcome to join you doesn’t make you welcoming, and that your friends will do stupid things and sometimes that’s okay and sometimes you should join them.  I learned about the highs and lows of romantic relationships and about both deep and shallow friendships, all of which I certainly found more of than in high school.  What I learned about people was mostly squishy and abstract, but it’s been an absolutely critical part of growing up.&lt;/p&gt;

&lt;h2 id=&quot;on-what-it-means-to-care&quot;&gt;On what it means to care&lt;/h2&gt;

&lt;p&gt;And, as strange as it is to say as such, I realize that as an undergrad I learned to care.  This isn’t to say I hadn’t valued anything before – certainly my family was important to me before, for instance – but in some sense which is difficult to describe I learned how to really, deeply &lt;em&gt;care&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;I learned to care about ESP.  The best and the worst thing about being in charge of the organization was the amount of ownership and responsibility I felt for it.  It was the worst thing because that responsibility translated pretty directly into work, and into constantly thinking about what things meant for ESP.  When I screwed up as chair, I noticed, because I could see how it affected this thing I care about.  But the other side of that responsibility was that I felt a stake in the success of ESP.  I cared about ESP and its students, teachers, and admins, and while I could take direct credit for only a very small part of whatever they collectively did, I was proud to be a part of it.  And while the responsibilities of being chair faded as my term as chair ended, I still care a lot about ESP, and I’m still happy whenever it does something awesome, which it turns out is quite often.&lt;/p&gt;

&lt;p&gt;I learned to care about the world.  In high school if someone asked I would have said that of course I wanted to improve the world, but to be honest I didn’t think much about it – I tried to be a good person when I got an opportunity but didn’t particularly seek them out.  Even freshman year when I joined ESP it was in large part because it was fun and it was what my friends were doing.  And sometime in the following four years, I discovered I actually cared about the world.  I learned that the best place to be at the end of an ESP program is at helpdesk in Lobby 10, to see all of the smiling students, parents, teachers, and admins as they leave more excited about learning than when they arrived.  I learned just how many people have vastly fewer opportunities than I, and I learned that that’s something that &lt;em&gt;bothers&lt;/em&gt; me.  I learned that I want to do something with my life that is useful to the world in whatever small way it can be, and that I hope that everyone who is able to does the same.  (And I learned that not everyone is able to do so!  And that it’s worth giving people the benefit of the doubt and recognizing that being able to do something about these problems is itself a privilege.)  I learned that the world is a pretty shitty place, but that we can make it just a little bit less shitty if we try.&lt;/p&gt;

&lt;p&gt;And I learned to care about people.  I had had friends before, but the peers I lived with and worked with on problem sets and extracurriculars became incredibly important to me.  I learned that if you end up in the hospital in a snowstorm, your friends will trek through any amount of weather to help you get back home.  I learned that when you’re still staring at piles of Feynman diagrams at 6am it’s a bit more fun when it’s with friends.  And I learned how, and when, and why, to shout “BONFAAR” at the top of my lungs with my floormates.  Four years later, I care about those friends in a new way.&lt;/p&gt;

&lt;h2 id=&quot;on-why-it-all-matters&quot;&gt;On why it all matters&lt;/h2&gt;

&lt;p&gt;I learned a lot, by experiencing it, about the value of the undergraduate experience.  I already knew there was a lot more to it than classes, but I learned how small a part of my education happened in a lecture.  I worry that as we can offer the more academic parts of an education more cheaply online, we’ll lose the rest, or worse, we’ll end up with a two-tiered system in which only the privileged get these more important but less quantifiable parts of an education.  I don’t think &lt;a href=&quot;https://www.khanacademy.org&quot;&gt;Khan Academy&lt;/a&gt;’s mission to offer a free, world-class education for anyone, anywhere will be complete until we can provide that too.&lt;sup id=&quot;fnref:disclaimer&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:disclaimer&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;Thanks among others to &lt;a href=&quot;http://web.mit.edu/mitoc/www/&quot;&gt;MITOC&lt;/a&gt; I (re-)discovered a love of hiking.  And in doing so, I discovered that one of the reasons I love standing on top of a mountain is that what I see is, in the end, so fleeting – the mountain won’t look the same the next day, nor will I be back then, or perhaps ever.  There will be other mountains on other days, but none quite the same, and the pictures won’t measure up, and that makes the moment at the top what it is.  At the end of my four years I learned that being an undergrad has the same fleeting beauty – I won’t again be chair of ESP, or live with exactly the same group of people, nor, necessarily, would I want to, and I learned that’s part of what makes it special.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Thanks to Miriam Gershenson for comments on a draft.&lt;/em&gt;&lt;/p&gt;
&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:layers&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;By my count, a mathematical structure like \(\mathbb{R}^n\) is an abstraction over anything in reality; point-set topology abstracts those; (co)homology, then cohomology operations add two more; and then the Steenrod Algebra sits on top of all of that. &lt;a href=&quot;#fnref:layers&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:bexley&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;With the exception of &lt;a href=&quot;http://everything2.com/title/Bexley+vs.+the+FBI&quot;&gt;a few&lt;/a&gt; &lt;a href=&quot;http://hacks.mit.edu/Hacks/by_year/1990/vest_bboard/&quot;&gt;stories&lt;/a&gt; that have been written down, and of course &lt;em&gt;&lt;a href=&quot;http://hackpunttool.com/&quot;&gt;Hack, Punt, Tool&lt;/a&gt;&lt;/em&gt;. &lt;a href=&quot;#fnref:bexley&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:disclaimer&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Obligatory disclaimer that my opinions here, and elsewhere on my blog, are my own. &lt;a href=&quot;#fnref:disclaimer&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Fri, 03 Jun 2016 00:00:00 +0000</pubDate>
        <link>http://www.benkraft.org/2016/06/03/what-did-i-learn/</link>
        <guid isPermaLink="true">http://www.benkraft.org/2016/06/03/what-did-i-learn/</guid>
        
        
      </item>
    
      <item>
        <title>The polar plot of sine</title>
        <description>&lt;p&gt;A couple weeks ago a &lt;a href=&quot;http://dannybendavid.com&quot;&gt;friend&lt;/a&gt; asked for intuition as to why the (polar) graph of \(r = \sin\theta\) is a circle.  It’s a fairly easy fact to prove algebraically, but neither he nor I had any intuition as to why it should be true, nor did the internet come to our aid.  I thought about it for a bit and came up with an explanation, and since I couldn’t find it anywhere online I’m posting it here in case it’s of interest to anyone else.&lt;/p&gt;

&lt;p&gt;First off, this is easy enough to do algebraically – we have \(x = r \cos\theta\) and \(y = r \sin\theta\), so multiplying both sides of \(r = \sin\theta\) by \(r\) we get \[x^2 + y^2 = r^2 = r \sin\theta = y.\]  We just rearrange and complete the square to get \[x^2 + \left(y - \frac12\right)^2 = \frac14,\] i.e., a circle of radius \(\frac12\) centered at \(\left(0, \frac12\right)\).  (Note that this technically only proves that the graph lies entirely on the circle, not that it traces the whole circle, but that’s mostly what we’re interested in anyway.)&lt;/p&gt;

&lt;p&gt;But the goal was intuition.  By plugging in a few numbers it’s not too hard to find the points where \(\theta\) is a multiple of \(\frac\pi4\) and see that they indeed lie on the correct circle, but that’s nothing resembling a proof.  The key observation turned out to be drawing the line from the point \((r, \theta)\) to the point where the circle meets the \(y\)-axis, or \((1, 0)\) in rectangular coordinates:&lt;/p&gt;

&lt;iframe scrolling=&quot;no&quot; src=&quot;https://www.geogebra.org/material/iframe/id/yqZMrWXI/width/500/height/400/border/eeeeee/rc/false/ai/false/sdz/false/smb/false/stb/false/stbh/true/ld/false/sri/false/at/auto&quot; width=&quot;500px&quot; height=&quot;400px&quot; style=&quot;border:0px;&quot;&gt; &lt;/iframe&gt;

&lt;p&gt;From here it’s pretty easy: the triangle is right because it’s inscribed in a semicircle; then the two marked angles are equal (and the one at the origin is by definition \(\theta\)).  Since the hypotenuse of the triangle has length \(1\), we can just use the definition of sine to get that the lower chord has length \(\sin\theta\) and thus the circle forms the graph we wanted.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Thanks to &lt;a href=&quot;http://dannybendavid.com&quot;&gt;Danny Ben-David&lt;/a&gt; for posing the question and reading a draft of this post.&lt;/em&gt;&lt;/p&gt;
</description>
        <pubDate>Thu, 18 Feb 2016 00:00:00 +0000</pubDate>
        <link>http://www.benkraft.org/2016/02/18/r-sin-theta/</link>
        <guid isPermaLink="true">http://www.benkraft.org/2016/02/18/r-sin-theta/</guid>
        
        
      </item>
    
      <item>
        <title>How I Teach Gerrymandering</title>
        <description>&lt;p&gt;Cross-posting from the brand-new &lt;a href=&quot;https://esp.mit.edu&quot;&gt;MIT ESP&lt;/a&gt; &lt;a href=&quot;http://mitesp.tumblr.com&quot;&gt;teacher blog&lt;/a&gt;: I wrote a &lt;a href=&quot;http://mitesp.tumblr.com/post/130793404248/how-i-teach-gerrymandering&quot;&gt;post&lt;/a&gt; about how I teach gerrymandering.  It of course starts with the famous cartoon.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/files/gerry-mander.jpg&quot; alt=&quot;The Gerry-Mander&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I’m going to be teaching it again at Splash in November, so suggestions are always welcome!&lt;/p&gt;
</description>
        <pubDate>Thu, 08 Oct 2015 00:00:00 +0000</pubDate>
        <link>http://www.benkraft.org/2015/10/08/how-i-teach-gerrymandering/</link>
        <guid isPermaLink="true">http://www.benkraft.org/2015/10/08/how-i-teach-gerrymandering/</guid>
        
        
      </item>
    
      <item>
        <title>My Feeds</title>
        <description>&lt;p&gt;A couple people have asked me for this, so here’s a list of all the RSS/Atom feeds I follow.  It’s autogenerated from Feedly, with some manual removal of dead things.  If you want to import the whole assembly into your RSS reader (which I don’t recommend), you can grab &lt;a href=&quot;/files/feeds.ompl&quot;&gt;the list in OMPL format&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Note: I don’t read all of these consistently.  I read all of “Comics”, and make an effort to read most of “Blogs”, and beyond that it’s just whatever headline happens to interest me.&lt;/p&gt;

&lt;h2 id=&quot;comics&quot;&gt;Comics&lt;/h2&gt;
&lt;p&gt;Because who can start their day without some webcomics?&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/Foxtrotcom&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.foxtrot.com&quot;&gt;FoxTrot&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.rsspect.com/rss/vagrant.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.harkavagrant.com&quot;&gt;Hark, A Vagrant!&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://phdunknown.com/rss.php&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.phdunknown.com/&quot;&gt;PhD Unknown&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.questionablecontent.net/QCRSS.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.questionablecontent.net&quot;&gt;QC&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.smbc-comics.com/rss.php&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.smbc-comics.com/&quot;&gt;SMBC&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://xkcd.com/atom.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://xkcd.com/&quot;&gt;xkcd&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/zenpencils&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://zenpencils.com&quot;&gt;ZEN PENCILS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;science-and-technology&quot;&gt;Science and Technology&lt;/h2&gt;

&lt;p&gt;And vaguely related things that have too high a volume to put in the “blogs” folder.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.arstechnica.com/arstechnica/everything&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://arstechnica.com&quot;&gt;Ars Technica&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.slate.com/blogs/bad_astronomy.fulltext.all.10.rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.slate.com/blogs/bad_astronomy.fulltext.all.10.rss&quot;&gt;Bad Astronomy&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.eff.org/rss/updates.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://www.eff.org/rss/updates.xml&quot;&gt;Deeplinks&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://kerbaldevteam.tumblr.com/rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://kerbaldevteam.tumblr.com/&quot;&gt;Kerbal Space Program Blog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://krebsonsecurity.com/feed/atom/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://krebsonsecurity.com&quot;&gt;Krebs on Security&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.popsci.com/rss.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.popsci.com/rss.xml&quot;&gt;Popular Science&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.quantamagazine.org/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://www.quantamagazine.org&quot;&gt;Quanta Magazine&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://rss.sciam.com/ScientificAmerican-Global&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.scientificamerican.com&quot;&gt;Scientific American&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://techcrunch.com/author/kim-mai-cutler/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://techcrunch.com&quot;&gt;TechCrunch » Kim-Mai Cutler&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.washingtonpost.com/blogs/the-switch/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.washingtonpost.com/blogs/the-switch&quot;&gt;The Switch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;wonks&quot;&gt;Wonks&lt;/h2&gt;

&lt;p&gt;News and current events.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://crookedtimber.org/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://crookedtimber.org&quot;&gt;Crooked Timber&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://topics.nytimes.com/top/opinion/editorialsandoped/oped/columnists/davidbrooks/index.html?rss=1&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.nytimes.com/column/david-brooks&quot;&gt;David Brooks - Op-Ed Columnist&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.lib.umn.edu/cspg/electionacademy/atom.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://blog.lib.umn.edu/cspg/electionacademy/&quot;&gt;Election Academy&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://fivethirtyeight.com/all/feed&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://fivethirtyeight.com&quot;&gt;FiveThirtyEight&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.npr.org/rss/rss.php?id=129828651&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.npr.org/sections/itsallpolitics/&quot;&gt;It&apos;s All Politics : NPR&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://topics.nytimes.com/top/opinion/editorialsandoped/oped/columnists/joenocera/index.html?rss=1&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.nytimes.com/column/joe-nocera&quot;&gt;Joe Nocera - Op-Ed Columnist&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/JonathanChaitRssFeed&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://nymag.com/feeds/&quot;&gt;Jonathan Chait RSS Feed&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/marginalrevolution/feed&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://marginalrevolution.com&quot;&gt;Marginal REVOLUTION&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://topics.nytimes.com/top/opinion/editorialsandoped/oped/columnists/maureendowd/index.html?rss=1&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.nytimes.com/column/maureen-dowd&quot;&gt;Maureen Dowd - Op-Ed Columnist&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/kqed/nHAK&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://ww2.kqed.org/mindshift&quot;&gt;MindShift&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.slate.com/blogs/moneybox.fulltext.all.10.rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.slate.com/blogs/moneybox.fulltext.all.10.rss&quot;&gt;Moneybox&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.washingtonpost.com/blogs/monkey-cage/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.washingtonpost.com/blogs/monkey-cage&quot;&gt;Monkey Cage&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://rss.nytimes.com/services/xml/rss/nyt/Upshot.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.nytimes.com/upshot?partner=rss&amp;amp;emc=rss&quot;&gt;NYT &amp;gt; The Upshot&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://topics.nytimes.com/top/opinion/editorialsandoped/oped/columnists/paulkrugman/index.html?rss=1&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.nytimes.com/column/paul-krugman&quot;&gt;Paul Krugman - Op-Ed Columnist&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://krugman.blogs.nytimes.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://krugman.blogs.nytimes.com&quot;&gt;Paul Krugman&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.washingtonpost.com/rss/rss_plum-line&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.washingtonpost.com/blogs/plum-line&quot;&gt;Plum Line&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/AtlanticPoliticsChannel&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.theatlantic.com/politics/&quot;&gt;Politics : The Atlantic&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://topics.nytimes.com/top/news/international/columns/rogercohen/index.html?rss=1&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.nytimes.com/column/roger-cohen&quot;&gt;Roger Cohen - Op-Ed Columnist&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.scotusblog.com/feed/atom/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.scotusblog.com&quot;&gt;SCOTUSblog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.washingtonpost.com/blogs/the-switch/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.washingtonpost.com/blogs/the-switch&quot;&gt;The Switch&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/Ta-nehisiCoates&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.theatlantic.com/ta-nehisi-coates/&quot;&gt;Ta-Nehisi Coates&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://topics.nytimes.com/top/opinion/editorialsandoped/oped/columnists/thomaslfriedman/index.html?rss=1&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.nytimes.com/column/thomas-l-friedman&quot;&gt;Thomas L. Friedman - Op-Ed Columnist&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.washingtonpost.com/news/volokh-conspiracy/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.washingtonpost.com/news/volokh-conspiracy&quot;&gt;The Volokh Conspiracy&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.vox.com/authors/ezra-klein/rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.vox.com/&quot;&gt;Vox: All Posts by Ezra Klein&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.vox.com/authors/matthew-yglesias/rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.vox.com/&quot;&gt;Vox: All Posts by Matthew Yglesias&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.vox.com/authors/sarah-kliff/rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.vox.com/&quot;&gt;Vox: All Posts by Sarah Kliff&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://equitablegrowth.org/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://equitablegrowth.org&quot;&gt;Washington Center for Equitable Growth&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.washingtonpost.com/rss/rss_ezra-klein&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.washingtonpost.com/blogs/wonkblog&quot;&gt;Wonkblog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;culture&quot;&gt;Culture&lt;/h2&gt;

&lt;p&gt;Miscellany of interest that’s more general than the other categories.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/AeonMagazineEssays&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://aeon.co/magazine&quot;&gt;Aeon Magazine&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.dissentmagazine.org/feed&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.dissentmagazine.org&quot;&gt;Dissent Magazine&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://longreads.com/rss/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://longreads.com/&quot;&gt;Longreads.com&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://medium.com/feed/message&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://medium.com/message?source=rss----81c7d351c056---4&quot;&gt;The Message — Medium&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://nautil.us/rss/all&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://nautil.us/rss/all&quot;&gt;Nautilus&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/Ta-nehisiCoates&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.theatlantic.com/ta-nehisi-coates/&quot;&gt;Ta-Nehisi Coates&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;food&quot;&gt;Food&lt;/h2&gt;
&lt;p&gt;I don’t read these regularly, but sometimes if I’m looking for ideas I do.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/TheAmateurGourmet&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.amateurgourmet.com&quot;&gt;Amateur Gourmet&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.ambitiouskitchen.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.ambitiouskitchen.com&quot;&gt;Ambitious Kitchen&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://chocolateandzucchini.com/index.rdf&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://chocolateandzucchini.com&quot;&gt;Chocolate &amp;amp; Zucchini&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/food52-TheAandMBlog&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://food52.com/blog&quot;&gt;Food52&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/elise/simplyrecipes&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.simplyrecipes.com&quot;&gt;Simply Recipes&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/smittenkitchen&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://smittenkitchen.com&quot;&gt;smitten kitchen&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;news-firehose&quot;&gt;News Firehose&lt;/h2&gt;

&lt;p&gt;I never read remotely close to all of this, it’s just a giant dump of something like 500 articles a day that I occasionally glance at.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://america.aljazeera.com/content/ajam/articles.rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://america.aljazeera.com/articles.rss&quot;&gt;Al Jazeera America&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/TheAtlantic&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.theatlantic.com/&quot;&gt;The Atlantic - Master Feed&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://electionlawblog.org/?feed=rss2&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://electionlawblog.org&quot;&gt;Election Law Blog »&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.theguardian.com/theguardian/us/rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.theguardian.com/us&quot;&gt;The Guardian World News&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://thehill.com/rss/syndicator/19110&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://thehill.com/rss/syndicator/19110&quot;&gt;TheHill - Most Popular&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.npr.org/rss/rss.php?id=1001&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.npr.org/templates/story/story.php?storyId=1001&quot;&gt;NPR News&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.nytimes.com/politics/first-draft/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.nytimes.com/politics/first-draft&quot;&gt;NYT &amp;gt; First Draft&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.nytimes.com/pages/index.html?partner=rss&amp;amp;emc=rss&quot;&gt;NYT &amp;gt; Home Page&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://rss.nytimes.com/services/xml/rss/nyt/Politics.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.nytimes.com/pages/politics/index.html?partner=rss&amp;amp;emc=rss&quot;&gt;NYT &amp;gt; Politics&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://rss.nytimes.com/services/xml/rss/nyt/Science.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.nytimes.com/pages/science/index.html?partner=rss&amp;amp;emc=rss&quot;&gt;NYT &amp;gt; Science&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://rss.nytimes.com/services/xml/rss/nyt/Technology.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.nytimes.com/pages/technology/index.html?partner=rss&amp;amp;emc=rss&quot;&gt;NYT &amp;gt; Technology&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://rss.nytimes.com/services/xml/rss/nyt/US.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.nytimes.com/pages/national/index.html?partner=rss&amp;amp;emc=rss&quot;&gt;NYT &amp;gt; U.S.&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://politicalwire.com/headlines.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://politicalwire.com&quot;&gt;Political Wire&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.politico.com/rss/politicopicks.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.politico.com&quot;&gt;POLITICO - TOP Stories&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://qz.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://qz.com&quot;&gt;Quartz&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.rollcall.com/rss/all_news.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.rollcall.com/&quot;&gt;Roll Call&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.slate.com/slate&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.slate.com/articles.teaser.all.10.rss&quot;&gt;Slate Articles&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.spiegel.de/international/index.rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.spiegel.de&quot;&gt;SPIEGEL ONLINE&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://talkingpointsmemo.com/feed/all&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://talkingpointsmemo.com/news&quot;&gt;TPM News&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.vox.com/rss/index.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.vox.com/&quot;&gt;Vox - All&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.washingtonpost.com/rss/homepage&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.washingtonpost.com?wprss=rss_homepage&quot;&gt;Washington Post&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.washingtonpost.com/rss/politics&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.washingtonpost.com/politics?wprss=rss_politics&quot;&gt;Washington Post Politics&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;blogs&quot;&gt;Blogs&lt;/h2&gt;

&lt;p&gt;A very motley assortment.  I usually make an effort to read all of these, although I don’t succeed.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://18f.gsa.gov/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://18f.gsa.gov&quot;&gt;18F Digital Services Delivery&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://4gravitonsandagradstudent.wordpress.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://4gravitons.wordpress.com&quot;&gt;4 gravitons and a grad student&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://niemann.blogs.nytimes.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://niemann.blogs.nytimes.com&quot;&gt;Abstract City&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.jaibot.com/?feed=rss2&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://blog.jaibot.com&quot;&gt;Almost No One is Evil; Almost Everything is Broken&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blogs.ams.org/mathgradblog/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://blogs.ams.org/mathgradblog&quot;&gt;AMS Grad Blog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://qchu.wordpress.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://qchu.wordpress.com&quot;&gt;Annoying Precision&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://extantelements.github.io/feed.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://extantelements.github.io/&quot;&gt;Anu Sinha&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://esr.ibiblio.org/?feed=rss2&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://esr.ibiblio.org&quot;&gt;Armed and Dangerous&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://benalpert.com/atom.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://benalpert.com/&quot;&gt;Ben Alpert&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://bjk5.com/rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://bjk5.com/&quot;&gt;Ben Kamens&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/bitquabit&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://bitquabit.com/&quot;&gt;bitquabit&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://byorgey.wordpress.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://byorgey.wordpress.com&quot;&gt;blog :: Brent -&amp;gt; [String]&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://worrydream.com/feed.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://worrydream.com/&quot;&gt;Bret Victor&apos;s website&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://christian-rationalist.blogspot.com/feeds/posts/default&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://christian-rationalist.blogspot.com/&quot;&gt;The Christian Rationalist&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://thecodelesscode.com/rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://thecodelesscode.com&quot;&gt;The Codeless Code&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://considerlearning.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://considerlearning.com&quot;&gt;Consider Learning&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.zephoria.org/thoughts/feed&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.zephoria.org/thoughts&quot;&gt;danah boyd | apophenia&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.djangoproject.com/rss/weblog/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://www.djangoproject.com/weblog/&quot;&gt;The Django weblog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.djnziv.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.djnziv.com&quot;&gt;DJNZiv&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://spaceflighthistory.blogspot.com/feeds/posts/default?alt=rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://spaceflighthistory.blogspot.com/&quot;&gt;DSFP&apos;s Spaceflight History Blog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://research.dyn.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://research.dyn.com&quot;&gt;Dyn Research&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://electionupdates.caltech.edu/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://electionupdates.caltech.edu&quot;&gt;Election Updates&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.mathematicalgemstones.com/feed&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.mathematicalgemstones.com&quot;&gt;Finding gemstones&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.langorigami.com/blog/?feed=rss2&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.langorigami.com/blog&quot;&gt;Folding Under Pressure&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://githubengineering.com/atom.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://githubengineering.com&quot;&gt;GitHub Engineering&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.goodmath.org/blog/?feed=rss2&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.goodmath.org/blog&quot;&gt;Good Math/Bad Math&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/patheos/ZYDf&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.patheos.com/blogs/gregepstein&quot;&gt;Good Without God&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/blogspot/MKuf&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://googleblog.blogspot.com/&quot;&gt;Google Blog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.habitlab.org/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.habitlab.org&quot;&gt;HabitLab&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://hpmor.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://hpmor.com&quot;&gt;Harry Potter and the Methods of Rationality Author&apos;s Notes&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://hpmor.com/rss.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://hpmor.com/&quot;&gt;Harry Potter and the Methods of Rationality&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://medium.com/feed/i-data&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://medium.com/i-data?source=rss----1a8eecba64d1---4&quot;&gt;i ❤ data — Medium&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/ezyang&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://blog.ezyang.com&quot;&gt;Inside 206-105&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://jaredly.github.io/rss.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://jaredly.github.io/&quot;&gt;Jared Forsyth&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://johncarlosbaez.wordpress.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://johncarlosbaez.wordpress.com&quot;&gt;John Baez&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/JohnResig&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://ejohn.org&quot;&gt;John Resig&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://jsomers.net/blog/feed&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://jsomers.net/blog&quot;&gt;the jsomers.net blog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://jvns.ca/atom.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://jvns.ca/&quot;&gt;Julia Evans&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://engineering.khanacademy.org/rss.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://engineering.khanacademy.org&quot;&gt;KA Engineering&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://data.khanacademy.org/feeds/posts/default&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://data.khanacademy.org/&quot;&gt;KADataScience&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://cs-blog.khanacademy.org/feeds/posts/default&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://cs-blog.khanacademy.org/&quot;&gt;Khan Academy Computing&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/KhanAcademy&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://khanacademy.tumblr.com/&quot;&gt;Khan Academy&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/lifeatka&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://life.khanacademy.org/&quot;&gt;Life at KA&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://maphugger.com/rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://maphugger.com/&quot;&gt;MapHugger&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://missmarcialee.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://missmarcialee.com&quot;&gt;marcia lee&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://mathwithbaddrawings.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://mathwithbaddrawings.com&quot;&gt;Math with Bad Drawings&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://jeremykun.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://jeremykun.com&quot;&gt;Math ∩ Programming&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://mathbabe.org/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://mathbabe.org&quot;&gt;mathbabe&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://themonadreader.wordpress.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://themonadreader.wordpress.com&quot;&gt;The Monad.Reader&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://golem.ph.utexas.edu/category/atom10.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://golem.ph.utexas.edu/category/&quot;&gt;The n-Category Café&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://topics.nytimes.com/top/opinion/editorialsandoped/oped/columnists/gailcollins/index.html?rss=1&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.nytimes.com/column/gail-collins&quot;&gt;NYT &amp;gt; Gail Collins&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://odl.mit.edu/category/blog/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://odl.mit.edu&quot;&gt;Office of Digital Learning » Blog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.aaronsw.com/2002/feeds/pgessays.rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.paulgraham.com/&quot;&gt;Paul Graham: Essays&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://election.princeton.edu/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://election.princeton.edu&quot;&gt;Princeton Election Consortium&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://quomodocumque.wordpress.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://quomodocumque.wordpress.com&quot;&gt;Quomodocumque&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://randsinrepose.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://randsinrepose.com&quot;&gt;Rands in Repose&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://facebook.github.io/react/feed.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://facebook.github.io/react&quot;&gt;React&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.ruthiebyers.com/rss.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.ruthiebyers.com&quot;&gt;Ruthie Byers&apos;s Blog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://saoatmit.wordpress.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://saoatmit.wordpress.com&quot;&gt;SAO&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.schneier.com/blog/atom.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://www.schneier.com/blog/&quot;&gt;Schneier on Security&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://csvoss.wordpress.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://csvoss.wordpress.com&quot;&gt;Science and Synesthesia&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.preposterousuniverse.com/blog/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.preposterousuniverse.com/blog&quot;&gt;Sean Carroll&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.benkraft.org/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.benkraft.org/&quot;&gt;self&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.scottaaronson.com/blog/?feed=rss2&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.scottaaronson.com/blog&quot;&gt;Shtetl-Optimized&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://slatestarcodex.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://slatestarcodex.com&quot;&gt;Slate Star Codex&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.andymatuschak.org/rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://blog.andymatuschak.org/&quot;&gt;Square Signals&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.stephjang.com/blog?format=RSS&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.stephjang.com/blog/&quot;&gt;Steph Jang&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/bigthink/blogs/strange-maps&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://bigthink.com/blogs/strange-maps&quot;&gt;Strange Maps | Big Think&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.tanyakhovanova.com/?feed=rss2&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://blog.tanyakhovanova.com&quot;&gt;Tanya Khovanova&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://terrytao.wordpress.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://terrytao.wordpress.com&quot;&gt;Terrence Tao&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.zacharyabel.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://blog.zacharyabel.com&quot;&gt;Three-Cornered Things&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://gowers.wordpress.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://gowers.wordpress.com&quot;&gt;Tim Gowers&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.arguingwithalgorithms.com/rss.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.arguingwithalgorithms.com/&quot;&gt;Tom Yedwab&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.turbovote.org/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://blog.turbovote.org&quot;&gt;TurboVote&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://vihart.com/blog/rss.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://vihart.com/&quot;&gt;Vi Hart&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://voteview.com/blog/?feed=rss2&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://voteview.com/blog&quot;&gt;Voteview&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://what-if.xkcd.com/feed.atom&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://what-if.xkcd.com/&quot;&gt;What If?&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.raeez.com/rss/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://blog.raeez.com/&quot;&gt;writings both incomplete and undecidable&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.xkcd.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://blog.xkcd.com&quot;&gt;xkcd&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/JamieWong&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://jamie-wong.com/&quot;&gt;Zero Wind :: Jamie Wong&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;overflow&quot;&gt;Overflow&lt;/h2&gt;

&lt;p&gt;Things I don’t read regularly, but keep around just in case.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds2.feedburner.com/3quarksdaily&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.3quarksdaily.com/3quarksdaily/&quot;&gt;3quarksdaily&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://apod.nasa.gov/apod.rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://antwrp.gsfc.nasa.gov/&quot;&gt;APOD&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/bigthink/main&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://bigthink.com/&quot;&gt;Big Think&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.cosmosmagazine.com/rss/opinion&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://cosmosmagazine.com&quot;&gt;COSMOS Opinion&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.dailykos.com/user/Comics/rss/index.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.dailykos.com/user/Comics/rss/index.xml&quot;&gt;Daily Kos Comics&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.joindiaspora.com/atom.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://blog.diasporafoundation.org&quot;&gt;Diaspora Blog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/DilbertDailyStrip&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://dilbert.com&quot;&gt;Dilbert&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.dropbox.com/?feed=rss2&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://dropboxmainblog.wordpress.com&quot;&gt;Dropbox Blog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://topics.nytimes.com/top/opinion/editorialsandoped/editorials/?rss=1&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://topics.nytimes.com/top/opinion/editorialsandoped/editorials/topics.nytimes.com/top/opinion/editorialsandoped/editorials/index.html?rss=1&quot;&gt;Editorials&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://electionlawblog.org/?feed=rss2&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://electionlawblog.org&quot;&gt;Election Law Blog »&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://fold.it/comm/puzzles_rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://fold.it&quot;&gt;Foldit Puzzles&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/fhq&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://frontloading.blogspot.com/&quot;&gt;Frontloading HQ&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/uclick/calvinandhobbes&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.gocomics.com/calvinandhobbes&quot;&gt;GoComics.com - Calvin and Hobbes...&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://rjlipton.wordpress.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://rjlipton.wordpress.com&quot;&gt;Gödel&apos;s Lost Letter and P=NP&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/ImprovEverywhere&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://improveverywhere.com&quot;&gt;Improv Everywhere&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://inappropriate-umlauts.tumblr.com/rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://inappropriate-umlauts.tumblr.com/&quot;&gt;Inappropriate Ümläüts&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.jacobinmag.com/category/blogs/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://www.jacobinmag.com&quot;&gt;Jacobin » Blogs&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://medium.com/feed/the-nib&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://thenib.com?source=rss----e74de0cedea9---4&quot;&gt;The Nib — Medium&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://kristof.blogs.nytimes.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://kristof.blogs.nytimes.com&quot;&gt;Nicholas D. Kristof&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/uclick/nonsequitur&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.gocomics.com/nonsequitur&quot;&gt;Non Sequitur&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://galoisrepresentations.wordpress.com/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://galoisrepresentations.wordpress.com&quot;&gt;Persiflage&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://physicsbuzz.physicscentral.com/feeds/posts/default?alt=rss&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://physicsbuzz.physicscentral.com/&quot;&gt;Physics Buzz&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.reddit.com/feeds/posts/default&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.redditblog.com/&quot;&gt;Reddit&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/salon/comics&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.salon.com&quot;&gt;Salon Comics&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://feeds.feedblitz.com/sethsblog&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://sethgodin.typepad.com/seths_blog/&quot;&gt;Seth Godin&apos;s Blog on marketing, tribes and respect&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.sporcle.com/blog/feed/&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.sporcle.com/blog&quot;&gt;Sporcle Blog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/Sporcle&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.sporcle.com&quot;&gt;Sporcle&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://scienceblogs.com/startswithabang/index.xml&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://scienceblogs.com/startswithabang&quot;&gt;Starts With A Bang&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/tedtalks_video&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.ted.com/talks/list&quot;&gt;TED&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/tsa/sDax&quot; class=&quot;rss-link&quot;&gt;&lt;img src=&quot;/files/feed-icon.svg&quot; alt=&quot;feed&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://blog.tsa.gov/&quot;&gt;The TSA Blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
        <pubDate>Sun, 14 Jun 2015 00:00:00 +0000</pubDate>
        <link>http://www.benkraft.org/2015/06/14/feeds/</link>
        <guid isPermaLink="true">http://www.benkraft.org/2015/06/14/feeds/</guid>
        
        
      </item>
    
      <item>
        <title>Physics is addicting</title>
        <description>&lt;p&gt;Something half-baked that I’ve been thinking about lately: I think physics is addicting.  In particular, I think learning physics is addicting in a way that math tends not to be.&lt;/p&gt;

&lt;p&gt;When one first learns electricity and magnetism, for example, there are a lot of things one just accepts, and places where one learns what is obviously an incomplete picture.  Some – like Coulomb’s law – are reasonable to just accept as axioms, but some – like these \(\mathbf{E}\)s and \(\mathbf{B}\)s floating around and the fact that changes in fields propagate at a speed \(c=\frac1{\sqrt{\mu_0\epsilon_0}}\) which is, notably, a constant – make it clear that there’s more going on.  So to fill the gaps, one takes another course in E&amp;amp;M, and another in special relativity, in which maybe one notices that the word ``acceleration’’ is conspicuously absent – thence general relativity.  And at some point the can of worms that is quantum mechanics gets opened.  First it comes as differential equations, but clearly there’s something more going on, so then it becomes linear algebra.  But at this point it’s obvious that to really understand things, one needs to learn quantum field theory.  By the end of the first course, there are as many gaps in the theory as gaps it fills, and while the second course will (I hope) fix some of those, it’s still not the end of the road.  In fact, it’s not clear that anyone knows where the end of the road even is.&lt;/p&gt;

&lt;p&gt;Contrast to math.  Calculus, as one learns it in high school or early college, is not the most self-contained, but soon thereafter most parts of math stand on their own.  Certainly after taking set theory, topology, and analysis, one can claim that all the things one knows, one fully understands.  That doesn’t mean there isn’t more to learn – algebra, for example, but it all in some sense builds up on top of the things already learned.  Homotopy groups take algebraic topology to understand, but they are, after all, a part of algebraic topology.  Where physics builds downwards, filling in the foundation of each concept with the next one, math builds upwards, one concept upon the next.&lt;/p&gt;

&lt;p&gt;I don’t know if this means anything about the fields.  Maybe it means mathematicians are better at figuring out how to learn things in a way that doesn’t leave lots of gaps, or maybe they are better at coming up with useful abstractions and suitable sets of axioms, or maybe they have an easier job since we &lt;em&gt;do&lt;/em&gt; have a reasonable foundation for math.  And I think to some extent parts of physics that I know less of may build up more – statistical mechanics, for one.  CS definitely does some of each: from basic programming one can go up, to heavier software engineering, algorithms, or AI, or down, to circuits, CPUs, and compilers.  But it does seem like an interesting difference to me.&lt;/p&gt;
</description>
        <pubDate>Tue, 30 Sep 2014 00:00:00 +0000</pubDate>
        <link>http://www.benkraft.org/2014/09/30/physics-is-addicting/</link>
        <guid isPermaLink="true">http://www.benkraft.org/2014/09/30/physics-is-addicting/</guid>
        
        
      </item>
    
  </channel>
</rss>
