<story><title>A bad citizen in Javaland (2006)</title><url>http://darrenhobbs.com/2006/04/22/a-bad-citizen-in-javaland/</url></story><parent_chain><item><author>koenigdavidmj</author><text>Sorting in O(n) time:&lt;p&gt;1. Apply a quantum permutation to your list.&lt;p&gt;2. Check if it&amp;#x27;s sorted.&lt;p&gt;3. If not, destroy the universe.</text></item><item><author>TeMPOraL</author><text>Hence, Many World Interpretation of quantum mechanics.</text></item><item><author>RyanZAG</author><text>Oh that makes for a funny part of the ending too then.&lt;p&gt;While going about your work, you suddenly disappear along with your universe and everything in it. Someone somewhere in the world drank a cup of coffee, which means that he now has an empty cup instead of a full cup. A new universe had to be created with the full cup replaced, and unfortunately your universe had to be thrown away. You continue life as a clone in a new universe with an empty coffee cup somewhere in Nebraska.&lt;p&gt;Why did this happen? Someone picked a copy-on-write map implementation because it had a slightly faster O(logN) delete behavior and unfortunately the re-use function of the map wasn&amp;#x27;t implemented yet because the author has gone on to do a series on the use of monads in baking the ultimate croissant.</text></item><item><author>danieldk</author><text>&lt;i&gt;You can&amp;#x27;t change the chair because it&amp;#x27;s all immutable, so you create a new chair along with a new universe and build a new car with the new chair.&lt;/i&gt;&lt;p&gt;No, if you read Okasaki, you knew you only have to reconstruct the part of the universe (up to its origin) that refers (directly or indirectly) to the seat ;).&lt;p&gt;In fact, you can safely have two universes with different seats, where most of the universes is shared.</text></item><item><author>RyanZAG</author><text>I wonder how a functional version of this would go..&lt;p&gt;You need transportation, so you define an engine and a set of wheels and a chair, and a whole universe. You define a way to have the engine, wheels and a chair work together. You try to sit in the chair, but it&amp;#x27;s too small. You can&amp;#x27;t change the chair because it&amp;#x27;s all immutable, so you create a new chair along with a new universe and build a new car with the new chair.&lt;p&gt;You need to get to work, but you don&amp;#x27;t want to pollute your universe with state, so you don&amp;#x27;t know where work is. So you put all of your state in your relational stateful database and forget that this part exists in your universe. Of course theoretically you could model your knowledge as a function based off the state of the universe, but you don&amp;#x27;t have budget to do that. You write comments about quick hacks to get around purity constraints. The hacks are never removed and you end up passing stateful maps of database tables around. You make a big todo note about how you should implement a new method for handling this that you&amp;#x27;ve read in a new academic paper, but never get the 500 hours you need to implement it.&lt;p&gt;EDIT: For those not getting it, the article is describing the difference between the theory behind OO interaction between self contained actors and how this really plays out in actual code. Instead of doing the theoretical part of communication between actors, we have code which does getCoworker().getWallet(). In the same way above, I&amp;#x27;ve tried to show the difference between theoretical functional programming where we can create pure functions and how this actually plays out in real functional code.</text></item></parent_chain><comment><author>evanpw</author><text>Related (amazing) paper by Scott Aaronson: &amp;quot;NP-complete Problems and Physical Reality&amp;quot; (&lt;a href=&quot;http:&amp;#x2F;&amp;#x2F;arxiv.org&amp;#x2F;abs&amp;#x2F;quant-ph&amp;#x2F;0502072&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;arxiv.org&amp;#x2F;abs&amp;#x2F;quant-ph&amp;#x2F;0502072&lt;/a&gt;). He proposes &amp;quot;anthropic computing&amp;quot; as a way of solving NP-complete problems in polynomial time: guess an answer, then kill yourself if the answer is wrong.</text></comment>
<story><title>A bad citizen in Javaland (2006)</title><url>http://darrenhobbs.com/2006/04/22/a-bad-citizen-in-javaland/</url></story><parent_chain><item><author>koenigdavidmj</author><text>Sorting in O(n) time:&lt;p&gt;1. Apply a quantum permutation to your list.&lt;p&gt;2. Check if it&amp;#x27;s sorted.&lt;p&gt;3. If not, destroy the universe.</text></item><item><author>TeMPOraL</author><text>Hence, Many World Interpretation of quantum mechanics.</text></item><item><author>RyanZAG</author><text>Oh that makes for a funny part of the ending too then.&lt;p&gt;While going about your work, you suddenly disappear along with your universe and everything in it. Someone somewhere in the world drank a cup of coffee, which means that he now has an empty cup instead of a full cup. A new universe had to be created with the full cup replaced, and unfortunately your universe had to be thrown away. You continue life as a clone in a new universe with an empty coffee cup somewhere in Nebraska.&lt;p&gt;Why did this happen? Someone picked a copy-on-write map implementation because it had a slightly faster O(logN) delete behavior and unfortunately the re-use function of the map wasn&amp;#x27;t implemented yet because the author has gone on to do a series on the use of monads in baking the ultimate croissant.</text></item><item><author>danieldk</author><text>&lt;i&gt;You can&amp;#x27;t change the chair because it&amp;#x27;s all immutable, so you create a new chair along with a new universe and build a new car with the new chair.&lt;/i&gt;&lt;p&gt;No, if you read Okasaki, you knew you only have to reconstruct the part of the universe (up to its origin) that refers (directly or indirectly) to the seat ;).&lt;p&gt;In fact, you can safely have two universes with different seats, where most of the universes is shared.</text></item><item><author>RyanZAG</author><text>I wonder how a functional version of this would go..&lt;p&gt;You need transportation, so you define an engine and a set of wheels and a chair, and a whole universe. You define a way to have the engine, wheels and a chair work together. You try to sit in the chair, but it&amp;#x27;s too small. You can&amp;#x27;t change the chair because it&amp;#x27;s all immutable, so you create a new chair along with a new universe and build a new car with the new chair.&lt;p&gt;You need to get to work, but you don&amp;#x27;t want to pollute your universe with state, so you don&amp;#x27;t know where work is. So you put all of your state in your relational stateful database and forget that this part exists in your universe. Of course theoretically you could model your knowledge as a function based off the state of the universe, but you don&amp;#x27;t have budget to do that. You write comments about quick hacks to get around purity constraints. The hacks are never removed and you end up passing stateful maps of database tables around. You make a big todo note about how you should implement a new method for handling this that you&amp;#x27;ve read in a new academic paper, but never get the 500 hours you need to implement it.&lt;p&gt;EDIT: For those not getting it, the article is describing the difference between the theory behind OO interaction between self contained actors and how this really plays out in actual code. Instead of doing the theoretical part of communication between actors, we have code which does getCoworker().getWallet(). In the same way above, I&amp;#x27;ve tried to show the difference between theoretical functional programming where we can create pure functions and how this actually plays out in real functional code.</text></item></parent_chain><comment><author>arethuza</author><text>That made me think of Greg Egan&amp;#x27;s &lt;i&gt;Quarantine&lt;/i&gt;:&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;en.wikipedia.org&amp;#x2F;wiki&amp;#x2F;Quarantine_%28Greg_Egan_novel%29&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;en.wikipedia.org&amp;#x2F;wiki&amp;#x2F;Quarantine_%28Greg_Egan_novel%...&lt;/a&gt;</text></comment>