<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:at="http://www.sixapart.com/ns/at"
    xmlns:icbm="http://postneo.com/icbm"
    xmlns:rvw="http://purl.org/NET/RVW/0.2/"
    xmlns:media="http://search.yahoo.com/mrss">
    <channel>
        <title>dæmonology</title>
        <link>http://jhw.vox.com/library/posts/page/1/</link>
        <description>fantasy, beer and functional code by j h woodyatt</description>
        <language>en</language>
        <generator>Vox</generator>
        <lastBuildDate>Sat, 29 Aug 2009 13:24:46 -0700</lastBuildDate>
        <copyright>Copyright 2009</copyright>
        <docs>http://blogs.law.harvard.edu/tech/rss</docs>  
 
        <item>
            <title>Jackie Speier Disappoints Me</title>
            <link>http://jhw.vox.com/library/post/jackie-speier-disappoints-me.html?_c=feed-rss-full</link>   
            <author>nobody@vox.com(j h woodyatt)</author>
            <comments>http://jhw.vox.com/library/post/jackie-speier-disappoints-me.html?_c=feed-rss-full</comments>
            <guid isPermaLink="true">http://jhw.vox.com/library/post/jackie-speier-disappoints-me.html?_c=feed-rss-full</guid> 
            <pubDate>Sat, 29 Aug 2009 13:24:46 -0700</pubDate>         
            
            <description>    &lt;p&gt;My member of the U.S. House of Representatives is &lt;strong&gt;Jackie Speier&lt;/strong&gt; (D-San Mateo). &amp;#160;I have just returned from her &lt;a href=&quot;http://speier.house.gov/index.cfm?sectionid=132&amp;amp;sectiontree=53,132&quot;&gt;Families and Health Care Forum Event&lt;/a&gt; at Burton Park in San Carlos, which was attended by a few hundred constituents of which only a handful were unruly and disorderly protestors. &amp;#160;I have some news to report about what her press director told me personally at the meeting when I could not address my question directly to the congresswoman.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Before I tell you what I heard, and why I&amp;#39;m disappointed, let me first be fair to her. &amp;#160;I should note the following points:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;She supports &lt;a href=&quot;http://www.opencongress.org/bill/111-h3200/show&quot;&gt;HR. 3200&lt;/a&gt;, the compromised but still acceptable House reform package with the gutless public option and the slow phase-in.&lt;/li&gt;&lt;li&gt;She also supports &lt;a href=&quot;http://www.hr676.org/&quot;&gt;HR. 676&lt;/a&gt;, the Kucinich amendment that would allow California and other states a way to implement single-payer systems.&lt;/li&gt;&lt;li&gt;She is one of 60 members who signed the &lt;a href=&quot;http://static1.firedoglake.com/30/files//2009/08/090730.pdf&quot;&gt;Pelosi Letter&lt;/a&gt;, which declares that the Waxman deal with the Blue Dog Democrats on the Energy and Commerce Committee that would gut the House bill of the public option and many of the other important provisions to control health care administrative costs.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;These are all good positions. &amp;#160;I&amp;#39;m glad she&amp;#39;s taken them. &amp;#160;So, why am I disappointed?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Because it&amp;#39;s clear to me that &lt;a href=&quot;http://www.dailykos.com/story/2009/8/23/125449/605&quot;&gt;she&amp;#39;s insincere&lt;/a&gt;. &amp;#160;She&amp;#39;s all in favor of &lt;em&gt;real health insurance reform&lt;/em&gt;, but not up to the point where she has to take a real stand where it counts. &amp;#160;How will she vote when the bill comes out of conference with the Senate, and it doesn&amp;#39;t have a public option for controlling costs? &amp;#160;When it doesn&amp;#39;t have subsidies for low income families? &amp;#160;When it has individual mandates for private health insurance with criminal penalties for compliance, but nothing to make private insurance either affordable or universal? &amp;#160;How will she vote then?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I put that question directly to her press director, Mike Larsen, and I made it clear that I want an unequivocal public declaration, now, not later when the outcome of the conference committee is a fait accompli. &amp;#160;He responded with two clear statements of the congresswoman&amp;#39;s position:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;She absolutely&amp;#160;&lt;strong&gt;will not&lt;/strong&gt; take the Firedoglake &lt;a href=&quot;http://campaignsilo.firedoglake.com/2009/08/16/sorry-cant-pass-health-care-bill-without-a-public-option/&quot;&gt;pledge&lt;/a&gt; to &lt;strong&gt;vote NO&lt;/strong&gt; if the final bill does not contain a real public option.&lt;/li&gt;&lt;li&gt;If the final bill fails to comprise a public option or any of the other improvements that her public statements say she supports, but President Obama promises to sign it, then &lt;strong&gt;she will vote YES&lt;/strong&gt; on the final bill.&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;Congresswoman Jackie Speier gives a decent slide deck, but I think we can safely say &lt;strong&gt;she isn&amp;#39;t committed&lt;/strong&gt; to real reform. &amp;#160;When the final bill comes, and it turns out to be a wet sloppy kiss from Senator Grassley to the&amp;#160;greedy and rapacious special interests in the health insurance industry, she is planning to sell out her constituents&amp;#39; health and families, while smiling and pretending that she did everything she could to prevent it. &amp;#160;It will be a dirty lie, and I plan to remind all my neighbors and friends in her district of that tawdry fact every chance I get.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Yes, I am extremely disappointed. &amp;#160;I gave the congresswoman money for her re-election in 2010 before I found out about this betrayal. &lt;em&gt;&amp;#160;I want my money back.&lt;/em&gt;&lt;/div&gt;&lt;/p&gt;    &lt;p style=&quot;clear:both;&quot;&gt; 
    &lt;a href=&quot;http://jhw.vox.com/library/post/jackie-speier-disappoints-me.html?_c=feed-rss-full#comments&quot;&gt;Read and post comments&lt;/a&gt;   |   
    &lt;a href=&quot;http://www.vox.com/share/6a00c225245f69f219011018690ed4860f?_c=feed-rss-full&quot;&gt;Send to a friend&lt;/a&gt; 
&lt;/p&gt;
 
            </description> 
            <category domain="http://jhw.vox.com/tags/">politics</category> 
            <category domain="http://jhw.vox.com/tags/">congress</category> 
            <category domain="http://jhw.vox.com/tags/">villainy</category> 
            <category domain="http://jhw.vox.com/tags/">spier</category> 
            <category domain="http://jhw.vox.com/tags/">hr 3200</category> 
            <category domain="http://jhw.vox.com/tags/">health insurance reform</category>   
        </item> 
 
        <item>
            <title>Persistent Union-Find Data Structure</title>
            <link>http://jhw.vox.com/library/post/persistent-union-find-data-structure.html?_c=feed-rss-full</link>   
            <author>nobody@vox.com(j h woodyatt)</author>
            <comments>http://jhw.vox.com/library/post/persistent-union-find-data-structure.html?_c=feed-rss-full</comments>
            <guid isPermaLink="true">http://jhw.vox.com/library/post/persistent-union-find-data-structure.html?_c=feed-rss-full</guid> 
            <pubDate>Thu, 02 Jul 2009 12:05:23 -0700</pubDate>         
            
            <description>    &lt;p&gt;In my previous post, I whined about how it didn&amp;#39;t seem to me that a pure-functional union-find data structure should be so hard to make as computationally efficient as the well-known imperative algorithms. &amp;#160;After some wonkulation on the subject, I convinced myself that— yes, bunky, it&amp;#39;s true— functional purity really &lt;em&gt;does&lt;/em&gt; cost extra, and sometimes it costs enough that it&amp;#39;s worth sacrificing purity for efficiency.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are a lot of techniques for hiding imperative code behind functional interfaces, and I know them fairly well at this point, so I thought I would try my hand at designing an [impure] persistent union-find data structure with optimal complexity characteristics.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I&amp;#39;m not by any count the first person to try to do this. &amp;#160;Sylvain Filliâtre and Jean-Christophe Conchon &lt;a href=&quot;http://www.lri.fr/~filliatr/puf/&quot;&gt;did it&lt;/a&gt; a few years ago, and &lt;em&gt;they&lt;/em&gt; were thorough enough to provide a formal proof in Coq alongside it. &amp;#160;They did a great job, but there are some nitpicky things about their code that I wish were done differently.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;blockquote class=&quot;webkit-indent-blockquote&quot; style=&quot;margin: 0 0 0 40px; border: none; padding: 0px;&quot;&gt;&lt;ul&gt;&lt;li&gt;FIND returns the representative element of the set, and I&amp;#39;d rather the code allowed for the representative of the equivalence class to be of a type different than the set elements. This is because I&amp;#39;m planning to use the data structure in a constraint solver for type inference.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Their code requires the elements to be integers suitable for indexing persistent arrays. &amp;#160;This is unacceptable for me. &amp;#160;I want an algorithm suitable for any totally ordered set of elements.&lt;/li&gt;&lt;/ul&gt;&lt;/blockquote&gt;&lt;div&gt;So, I wrote my own. &amp;#160;Instead of using persistent arrays, it uses the persistent set and priority queue data structures from the &lt;strong&gt;Cf&lt;/strong&gt; module in my &lt;a href=&quot;http://sourceforge.net/projects/ocnae/&quot;&gt;OCaml Network Application Environment&lt;/a&gt; library. &amp;#160;Here&amp;#39;s the [untested] code:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;blockquote class=&quot;webkit-indent-blockquote&quot; style=&quot;margin: 0 0 0 40px; border: none; padding: 0px;&quot;&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;module type T = sig&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;type k and +&amp;#39;a q and +&amp;#39;a t&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;val nil: &amp;#39;a t&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;val start: k -&amp;gt; &amp;#39;a -&amp;gt; &amp;#39;a t&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;val find: k -&amp;gt; &amp;#39;a t -&amp;gt; &amp;#39;a q option&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;val extract: &amp;#39;a q -&amp;gt; &amp;#39;a&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;val disjoint: &amp;#39;a t -&amp;gt; &amp;#39;a t -&amp;gt; &amp;#39;a t&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;val union: &amp;#39;a q -&amp;gt; &amp;#39;a q -&amp;gt; &amp;#39;a t&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;end&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;module Create(K: Cf_ordered.Total_T) : (T with type k = K.t) = struct&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;module U = Cf_rbtree.Set(K)&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;module H = Cf_sbheap.PQueue(Cf_ordered.Int_order)&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;type k = K.t&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;type &amp;#39;a q = Q of U.t * int * &amp;#39;a * &amp;#39;a t&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;and &amp;#39;a t = T of int * (k -&amp;gt; &amp;#39;a q option)&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;let void_ _ = None&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;let nil = T (0, void_)&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;let start k v =&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;let q = Some (Q (U.singleton k, 1, v, nil)) in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;let f k&amp;#39; = if K.compare k k&amp;#39; &amp;lt;&amp;gt; 0 then None else q in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;T (1, f)&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;let find k (T (_, f)) = f k&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;let extract (Q (_, _, v, _)) = v&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;type &amp;#39;a compressor = {&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;mutable z: int;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;mutable h: &amp;#39;a q H.t;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;mutable u: U.t;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;mutable f: k -&amp;gt; &amp;#39;a q option;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;}&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;let compress_ =&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;let rec loop c k h =&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;if U.member k c.u then&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;None&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;else&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;match H.pop h with&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;| Some (hd, tl) -&amp;gt;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;let _, q = hd in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;let Q (u, _, _, _) = q in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;if U.member k u then Some q else loop c k tl&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;| None -&amp;gt;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;if c.z = 0 then&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;None&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;else&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;match c.f k with&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;| None -&amp;gt;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;c.u &amp;lt;- U.put k c.u;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;None&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;| Some q as q1 -&amp;gt;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;let Q (_, n, _, _) = q in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;c.h &amp;lt;- H.put (n, q) c.h;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;let z = c.z - n in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;assert (z &amp;gt;= 0);&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;c.z &amp;lt;- z;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;if z == 0 then begin&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;c.f &amp;lt;- void_;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;c.u &amp;lt;- U.nil&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;end;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;q1&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;fun c k -&amp;gt;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;loop c k c.h&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;let disjoint a b =&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;if a == b then&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;a&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;else begin&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;let T (na, fa) = a and T (nb, fb) = b in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;let n = na + nb in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;let f =&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;if n &amp;gt; 1 then begin&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;let f1, f2 = if na &amp;gt; nb then fa, fb else fb, fa in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;fun k -&amp;gt; match f1 k with Some _ as q -&amp;gt; q | None -&amp;gt; f2 k&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;end&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;else if n &amp;gt; 0 then begin&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;if na &amp;gt; 0 then fa else fb&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;end&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;else&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;void_&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;let c = { z = n; h = H.nil; u = U.nil; f = f } in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;T (na + nb, compress_ c)&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;end&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160;let union a b =&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;let Q (ua, na, v, ta) = a and Q (ub, nb, _, tb) = b in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;if ta == tb &amp;amp;&amp;amp; ua == ub then&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;ta&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;else begin&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;let qn = na + nb in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;let T (n, f) as t = disjoint ta tb in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;let z = n - qn in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;assert (z &amp;gt;= 0);&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;let rec q = Q (U.union ua ub, qn, v, t)&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;and c = lazy { z = n; h = H.put (n, q) H.nil; u = U.nil; f = f } in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;let c = Lazy.force c in&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;T (n, compress_ c)&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;end&lt;/p&gt;&lt;p style=&quot;margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier&quot;&gt;end&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;As I mentioned above, this is totally untested code. &amp;#160;If you use it without testing the hell out of it yourself, then it will be your own damned fault if it bites your leg off. &amp;#160;I&amp;#39;ll be getting around to testing it someday soon, and if it works well, then I&amp;#39;ll be adding it to the next release of the &lt;strong&gt;Cf&lt;/strong&gt; library. &amp;#160;No promises on when.&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;How does this code work? &amp;#160;It&amp;#39;s easy, really.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;In the module signature of the functor, type &lt;strong&gt;k&lt;/strong&gt; is the set element type (&amp;#39;k&amp;#39; is for &amp;#39;key&amp;#39; here), &lt;strong&gt;&amp;#39;a q&lt;/strong&gt; is the type of equivalence classes where each key in the class is equivalent to a value of type &amp;#39;a, and &lt;strong&gt;&amp;#39;a t&lt;/strong&gt; is the type of disjoint sets partitioned by equivalence class.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;The empty disjoint set is &lt;strong&gt;nil&lt;/strong&gt;. &amp;#160;It contains no equivalence classes.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;To create a new disjoint set with a single key &lt;strong&gt;k&lt;/strong&gt; and its representative value &lt;strong&gt;v&lt;/strong&gt;, use &lt;strong&gt;start k v&lt;/strong&gt;. &amp;#160;Use &lt;strong&gt;find k t&lt;/strong&gt; to search the disjoint set &lt;strong&gt;t&lt;/strong&gt; for an equivalence class containing key &lt;strong&gt;k&lt;/strong&gt;. &amp;#160;Use &lt;strong&gt;extract q&lt;/strong&gt; to extract the representative value from the equivalence class &lt;strong&gt;q&lt;/strong&gt;. &amp;#160;The &lt;strong&gt;find&lt;/strong&gt; function has a variable cost discussed below, but &lt;strong&gt;start&lt;/strong&gt; and &lt;strong&gt;extract&lt;/strong&gt; both have constant cost.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;It is an invariant that the optional value &lt;strong&gt;q&lt;/strong&gt; returned for positive results of a search with&amp;#160;&lt;strong&gt;find k t&lt;/strong&gt; is always the same for every equivalent key &lt;strong&gt;k&lt;/strong&gt; in the disjoint set &lt;strong&gt;t&lt;/strong&gt;. &amp;#160;Each&amp;#160;&lt;strong&gt;q&lt;/strong&gt;&amp;#160;returned by &lt;strong&gt;find k t&lt;/strong&gt; contains a reference to&amp;#160;&lt;strong&gt;t&lt;/strong&gt;&amp;#160;to facilitate&amp;#160;&lt;em&gt;path compression&lt;/em&gt;, which is discussed below. &amp;#160;The cost of &lt;strong&gt;find&lt;/strong&gt; is a the cost of searching a memorized queue of previously found equivalence classes, prioritized by size from largest to smallest, plus the cost of searching any predecessors for remaining equivalence classes, plus the cost when there are still predecessors&amp;#160;of searching a cache of negative results.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;To combine two existing disjoint sets &lt;strong&gt;a&lt;/strong&gt; and &lt;strong&gt;b&lt;/strong&gt; into a new disjoint set comprising equivalence classes from each, use&amp;#160;&lt;strong&gt;disjoint a b&lt;/strong&gt;&amp;#160;. &amp;#160;If &lt;strong&gt;a&lt;/strong&gt; and &lt;strong&gt;b&lt;/strong&gt; are identical values, then this is a trivial operation. &amp;#160;Otherwise, a fresh path compressor is used to memorize equivalence classes when searching the two predecessors. &amp;#160;Applying &lt;strong&gt;disjoint&lt;/strong&gt; to a pair of predecessors that contain overlapping equivalence classes is not an error, but the results might seem arbitrary: the predecessors are only searched by&amp;#160;&lt;strong&gt;find k t&lt;/strong&gt; when no previous search of &lt;strong&gt;t&lt;/strong&gt; has returned an equivalence class containing &lt;strong&gt;k&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal; &quot;&gt;; when the predecessors are searched, the larger predecessor &lt;/span&gt;p1&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal; &quot;&gt; is searched first with &lt;/span&gt;find k p1&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal; &quot;&gt;, then the smaller predecessor &lt;/span&gt;p2&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal; &quot;&gt; is searched with &lt;/span&gt;find k p2&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal; &quot;&gt;. The first positive result is memorized by the path compressor. &amp;#160;A pair of negative results is also memorized. &amp;#160;Once all the predecessor equivalence classes are memorized, the associated search function in the compressor is destroyed, which allows the predecessors to be collected.&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;Finally, use &lt;strong&gt;union a b&lt;/strong&gt; to create a new disjoint set comprising a fresh path compressor constructed to search the predecessors encapsulated in &lt;strong&gt;a&lt;/strong&gt; and &lt;strong&gt;b&lt;/strong&gt;, and with memory pre-initialized to&amp;#160;the equivalence class produced by merging the key sets&amp;#160;and choosing the value represented by&amp;#160;&lt;strong&gt;a&lt;/strong&gt; as representative of the new class. &amp;#160;As discussed above with regard to the likewise &lt;strong&gt;disjunct&lt;/strong&gt; function, if &lt;strong&gt;a&lt;/strong&gt; and &lt;strong&gt;b&lt;/strong&gt; were found in overlapping disjoint sets, then the choice of which equivalence classes are memorized in the path compressor is arbitrary.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #000000&quot;&gt;Worth noting: it&amp;#39;s not clear to me that the negative cache is worth it. &amp;#160;If you always search for keys that you know are present in the disjoint set, then the cache won&amp;#39;t hurt much. &amp;#160;However, negative results from searches in uncompressed sets are costly. &amp;#160;A negative result can only be obtained by iteratively descending the predecessor graph to make sure none of them have an equivalence class that needs to be memorized. &amp;#160;I&amp;#39;m not sure there&amp;#39;s much to be gained by caching such negative results until the path compressor determines that the equivalence classes in the predecessors are exhausted. &amp;#160;That will certainly be one of the things I will set about to testing when I next get time for this project.&lt;/span&gt;&lt;/div&gt;&lt;/p&gt;    &lt;p style=&quot;clear:both;&quot;&gt; 
    &lt;a href=&quot;http://jhw.vox.com/library/post/persistent-union-find-data-structure.html?_c=feed-rss-full#comments&quot;&gt;Read and post comments&lt;/a&gt;   |   
    &lt;a href=&quot;http://www.vox.com/share/6a00c225245f69f219011018469553860f?_c=feed-rss-full&quot;&gt;Send to a friend&lt;/a&gt; 
&lt;/p&gt;
 
            </description> 
            <category domain="http://jhw.vox.com/tags/">code</category> 
            <category domain="http://jhw.vox.com/tags/">functional programming</category> 
            <category domain="http://jhw.vox.com/tags/">union-find</category>   
        </item> 
 
        <item>
            <title>Pure Functional Disjoint Set Union-Find...</title>
            <link>http://jhw.vox.com/library/post/pure-functional-disjoint-set-union-find.html?_c=feed-rss-full</link>   
            <author>nobody@vox.com(j h woodyatt)</author>
            <comments>http://jhw.vox.com/library/post/pure-functional-disjoint-set-union-find.html?_c=feed-rss-full</comments>
            <guid isPermaLink="true">http://jhw.vox.com/library/post/pure-functional-disjoint-set-union-find.html?_c=feed-rss-full</guid> 
            <pubDate>Wed, 01 Jul 2009 11:26:26 -0700</pubDate>         
            
            <description>    &lt;p&gt;...is apparently not terribly efficient. &amp;#160;This makes me sad. &amp;#160;The problem doesn&amp;#39;t seem like it should be as hard as it appears to be. &amp;#160;This makes me &lt;em&gt;more&lt;/em&gt; sad.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I&amp;#39;ve been doing a lot of pure functional programming. &amp;#160;I wonder if I can discover a pure-functional &lt;a href=&quot;http://en.wikipedia.org/wiki/Disjoint-set_data_structure&quot;&gt;union-find data structure&lt;/a&gt; with computational complexity similar to Tarjan&amp;#39;s optimal imperative algorithm. &amp;#160;Grmf.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;Update:&lt;/strong&gt; okay, I think I&amp;#39;ve convinced myself that purism really is a lost cause on this subject. &amp;#160;How-some-ever, I&amp;#39;ve now written a &lt;em&gt;persistent&lt;/em&gt;&amp;#160;[impure] functional union-find data structure that I believe has optimal computational complexity. &amp;#160;I&amp;#39;ll post a follow-up.&lt;/div&gt;&lt;/p&gt;    &lt;p style=&quot;clear:both;&quot;&gt; 
    &lt;a href=&quot;http://jhw.vox.com/library/post/pure-functional-disjoint-set-union-find.html?_c=feed-rss-full#comments&quot;&gt;Read and post comments&lt;/a&gt;   |   
    &lt;a href=&quot;http://www.vox.com/share/6a00c225245f69f21901101845c41d860f?_c=feed-rss-full&quot;&gt;Send to a friend&lt;/a&gt; 
&lt;/p&gt;
 
            </description> 
            <category domain="http://jhw.vox.com/tags/">code</category> 
            <category domain="http://jhw.vox.com/tags/">algorithms</category> 
            <category domain="http://jhw.vox.com/tags/">functional programming</category>   
        </item> 
 
        <item>
            <title>I Am Officially Weirded Out</title>
            <link>http://jhw.vox.com/library/post/i-am-officially-weirded-out.html?_c=feed-rss-full</link>   
            <author>nobody@vox.com(j h woodyatt)</author>
            <comments>http://jhw.vox.com/library/post/i-am-officially-weirded-out.html?_c=feed-rss-full</comments>
            <guid isPermaLink="true">http://jhw.vox.com/library/post/i-am-officially-weirded-out.html?_c=feed-rss-full</guid> 
            <pubDate>Tue, 26 May 2009 20:17:25 -0700</pubDate>         
            
            <description>    &lt;p&gt;Apparently, the ghost of &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: bold;&quot;&gt;Jon Postel&lt;/span&gt; is leading a pack of superheroes determined to defend the Internet from Fear Uncertainty and Doubt. &amp;#160;Promote The Internet Way with &lt;a href=&quot;https://www.arin.net/knowledge/comic.html&quot;&gt;Team ARIN&lt;/a&gt;!&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;blockquote class=&quot;webkit-indent-blockquote&quot; style=&quot;margin: 0 0 0 40px; border: none; padding: 0px;&quot;&gt;&lt;p&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); font-size: 12px; line-height: 16px; &quot;&gt;Welcome to the world of Team ARIN! We hope you find these publications educational and entertaining. Team ARIN is a fictionalized view of the American Registry for Internet Numbers (ARIN), its processes, and the whole concept of Internet governance. Though our heroes are fictional, the issues they face are very real.&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote class=&quot;webkit-indent-blockquote&quot; style=&quot;margin: 0 0 0 40px; border: none; padding: 0px;&quot;&gt;&lt;p&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); font-size: 12px; line-height: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); font-size: 12px; line-height: 16px; &quot;&gt;Team ARIN is a group of superheroes that represent four of the principles by which the Internet is operated and governed...&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/p&gt;    &lt;p style=&quot;clear:both;&quot;&gt; 
    &lt;a href=&quot;http://jhw.vox.com/library/post/i-am-officially-weirded-out.html?_c=feed-rss-full#comments&quot;&gt;Read and post comments&lt;/a&gt;   |   
    &lt;a href=&quot;http://www.vox.com/share/6a00c225245f69f2190110165187a2860c?_c=feed-rss-full&quot;&gt;Send to a friend&lt;/a&gt; 
&lt;/p&gt;
 
            </description> 
            <category domain="http://jhw.vox.com/tags/">fantasy</category> 
            <category domain="http://jhw.vox.com/tags/">villainy</category> 
            <category domain="http://jhw.vox.com/tags/">kill me now</category> 
            <category domain="http://jhw.vox.com/tags/">ietf</category> 
            <category domain="http://jhw.vox.com/tags/">ipv6</category>   
        </item> 
 
        <item>
            <title>A Fine Rant For Colleagues To Read</title>
            <link>http://jhw.vox.com/library/post/a-fine-rant-for-colleagues-to-read.html?_c=feed-rss-full</link>   
            <author>nobody@vox.com(j h woodyatt)</author>
            <comments>http://jhw.vox.com/library/post/a-fine-rant-for-colleagues-to-read.html?_c=feed-rss-full</comments>
            <guid isPermaLink="true">http://jhw.vox.com/library/post/a-fine-rant-for-colleagues-to-read.html?_c=feed-rss-full</guid> 
            <pubDate>Tue, 28 Apr 2009 16:25:52 -0700</pubDate>         
            
            <description>    &lt;p&gt;&lt;a href=&quot;http://enfranchisedmind.com/blog/posts/the-problem-with-stm-your-languages-still-suck/&quot;&gt;The Problem With Software Transactional Memory: Your Languages Still Suck&lt;/a&gt;.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;He&amp;#39;s right, too. &amp;#160;Parallelism is a bitch. &amp;#160;Anyone who has ever had this experience...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;blockquote class=&quot;webkit-indent-blockquote&quot; style=&quot;margin: 0 0 0 40px; border: none; padding: 0px;&quot;&gt;&lt;p&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana; font-size: 9px; line-height: 16px; &quot;&gt;Classic threads and locks (or threads and synchronized, for you Java programmers) lead to the worst sort of Heisenbugs. True story: I once had to trace down a race condition that, doing several thousand tests per second, only manifested itself once every four days on average. The vast majority of the time it’d work just fine- the rate of failure was small enough it had escaped testing (think about it- you’ve been running the same test, thousands of times a second, for three days, and it hasn’t failed yet- when do you declare that it looks like the test is working?), but it was common enough that it was causing our customer to lock up about once a week, so it had to get fixed. Oh, and threads and locks aren’t compositional- you can’t take two hunks of code which are individually correct, and combine them to form one large, correct, piece of code. But hey, it’s not like code reuse is that important to programmers, is it?&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana; font-size: 9px; line-height: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;...doesn&amp;#39;t need to be told how symmetric multiprocessing with traditional threads and locks is the shadow of death, the mindkiller, a road of bones down which nothing but torment and pain will you ever find.&lt;/div&gt;&lt;/p&gt;    &lt;p style=&quot;clear:both;&quot;&gt; 
    &lt;a href=&quot;http://jhw.vox.com/library/post/a-fine-rant-for-colleagues-to-read.html?_c=feed-rss-full#comments&quot;&gt;Read and post comments&lt;/a&gt;   |   
    &lt;a href=&quot;http://www.vox.com/share/6a00c225245f69f2190110164300d3860c?_c=feed-rss-full&quot;&gt;Send to a friend&lt;/a&gt; 
&lt;/p&gt;
 
            </description> 
            <category domain="http://jhw.vox.com/tags/">code</category> 
            <category domain="http://jhw.vox.com/tags/">computer science</category> 
            <category domain="http://jhw.vox.com/tags/">parallelism</category> 
            <category domain="http://jhw.vox.com/tags/">language design</category>   
        </item> 
 
        <item>
            <title>Apparently...</title>
            <link>http://jhw.vox.com/library/post/apparently.html?_c=feed-rss-full</link>   
            <author>nobody@vox.com(j h woodyatt)</author>
            <comments>http://jhw.vox.com/library/post/apparently.html?_c=feed-rss-full</comments>
            <guid isPermaLink="true">http://jhw.vox.com/library/post/apparently.html?_c=feed-rss-full</guid> 
            <pubDate>Wed, 18 Mar 2009 16:53:53 -0700</pubDate>         
            
            <description>    &lt;p&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); font-family: &amp;#39;Lucida Grande&amp;#39;; font-size: 11px; white-space: pre-wrap; &quot;&gt;&lt;table style=&quot;text-align: center; width: 90%&quot;&gt;&lt;tr&gt;&lt;td style=&quot;width: 1%&quot;&gt;&lt;img height=&quot;200&quot; src=&quot;http://paulkienitz.net/quizpix/skiffy_kurt.jpg&quot; width=&quot;200&quot; /&gt;&lt;/td&gt;&lt;td&gt;I am:&lt;blockquote&gt;&lt;p&gt;&lt;big&gt;&lt;big&gt;&lt;strong&gt;Kurt Vonnegut&lt;/strong&gt;&lt;/big&gt;&lt;/big&gt;&lt;/p&gt;&lt;/blockquote&gt;For years, this unique creator of absurd and haunting tales denied that he had anything to do with science fiction.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;div style=&quot;text-align: center&quot;&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;a href=&quot;http://paulkienitz.net/skiffy.html&quot;&gt;Which science fiction writer are you?&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
&lt;/span&gt; &lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); font-family: &amp;#39;Lucida Grande&amp;#39;; font-size: 11px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); font-family: &amp;#39;Lucida Grande&amp;#39;; font-size: 11px; white-space: pre-wrap;&quot;&gt;For the record, yes I do continue to insist that I&amp;#39;m a writer of fantasy, not science-fiction.  So, perhaps this comparison is not &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: italic;&quot;&gt;entirely&lt;/span&gt; full of bogosity.&lt;/span&gt;&lt;/div&gt;&lt;/p&gt;    &lt;p style=&quot;clear:both;&quot;&gt; 
    &lt;a href=&quot;http://jhw.vox.com/library/post/apparently.html?_c=feed-rss-full#comments&quot;&gt;Read and post comments&lt;/a&gt;   |   
    &lt;a href=&quot;http://www.vox.com/share/6a00c225245f69f21901101637566d860c?_c=feed-rss-full&quot;&gt;Send to a friend&lt;/a&gt; 
&lt;/p&gt;
 
            </description> 
            <category domain="http://jhw.vox.com/tags/">sf/f fiction</category> 
            <category domain="http://jhw.vox.com/tags/">meme vector</category>   
        </item> 
 
        <item>
            <title>An Abstract Machine</title>
            <link>http://jhw.vox.com/library/post/an-abstract-machine.html?_c=feed-rss-full</link>   
            <author>nobody@vox.com(j h woodyatt)</author>
            <comments>http://jhw.vox.com/library/post/an-abstract-machine.html?_c=feed-rss-full</comments>
            <guid isPermaLink="true">http://jhw.vox.com/library/post/an-abstract-machine.html?_c=feed-rss-full</guid> 
            <pubDate>Thu, 12 Mar 2009 21:16:04 -0700</pubDate>         
            
            <description>    &lt;p&gt;I seem to have one. &amp;#160;Here&amp;#39;s the OCaml signature. &amp;#160;The module file is all of 250 lines at this point, but I expect to define a lot of built-in processes for the preamble. &amp;#160;That will bloat out the module file.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;blockquote class=&quot;webkit-indent-blockquote&quot; style=&quot;margin: 0 0 0 40px; border: none; padding: 0px;&quot;&gt;&lt;p&gt;type &amp;#39;a t&lt;/p&gt;&lt;p&gt;module Op: sig&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;val ( &amp;gt;&amp;gt;= ): &amp;#39;a t -&amp;gt; (&amp;#39;a -&amp;gt; &amp;#39;b t) -&amp;gt; &amp;#39;b t&lt;br /&gt;end&lt;/p&gt;&lt;p&gt;val return: &amp;#39;a -&amp;gt; &amp;#39;a t&lt;br /&gt;val eval: unit t -&amp;gt; unit&lt;/p&gt;&lt;p&gt;type n&lt;br /&gt;type repeat = Once | Always&lt;/p&gt;&lt;p&gt;val nil: unit t&lt;br /&gt;val start: unit t -&amp;gt; unit t&lt;br /&gt;val lambda: n t&lt;br /&gt;val nu: n t&lt;br /&gt;val fusion: n -&amp;gt; repeat -&amp;gt; n list -&amp;gt; unit t -&amp;gt; unit t&lt;/p&gt;&lt;p&gt;val v_void: n&lt;br /&gt;val v_true: n&lt;br /&gt;val v_false: n&lt;/p&gt;&lt;p&gt;val if_then_else: n -&amp;gt; unit t -&amp;gt; unit t -&amp;gt; unit t&lt;/p&gt;&lt;p&gt;type dio = D_in | D_out&lt;br /&gt;val def: dio list -&amp;gt; (n array -&amp;gt; unit t) -&amp;gt; n t&lt;/p&gt;&lt;p&gt;val preamble: n Name.Map.t t&lt;/p&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Basically, the abstract machine is a monad. &amp;#160;I&amp;#39;ll compile programs into an abstract syntax tree, then when the tree is pruned until it conforms to all the syntax and semantics invariants, I&amp;#39;ll visit the nodes to compose a monad value. &amp;#160;I&amp;#39;ll execute the program by evaluating the monad. &amp;#160;To say that it will not be fast is an understatement of Brobdingagian proportions. &amp;#160;It will be simulating concurrency in a single thread of control, which will seem like a wide miss of the whole point. &amp;#160;It will, however, allow me to experiment with higher-level language syntax and semantics for a while before I hit the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: italic;&quot;&gt;next&lt;/span&gt; wall, where I expect I will need to write a byte code interpreter in C with POSIX threads to make further progress.&lt;/div&gt;&lt;/p&gt;    &lt;p style=&quot;clear:both;&quot;&gt; 
    &lt;a href=&quot;http://jhw.vox.com/library/post/an-abstract-machine.html?_c=feed-rss-full#comments&quot;&gt;Read and post comments&lt;/a&gt;   |   
    &lt;a href=&quot;http://www.vox.com/share/6a00c225245f69f219011015f0c51d860b?_c=feed-rss-full&quot;&gt;Send to a friend&lt;/a&gt; 
&lt;/p&gt;
 
            </description> 
            <category domain="http://jhw.vox.com/tags/">computer science</category> 
            <category domain="http://jhw.vox.com/tags/">language design</category> 
            <category domain="http://jhw.vox.com/tags/">π-calculus</category>   
        </item> 
 
        <item>
            <title>Hey, Ecuador!</title>
            <link>http://jhw.vox.com/library/post/hey-ecuador.html?_c=feed-rss-full</link>   
            <author>nobody@vox.com(j h woodyatt)</author>
            <comments>http://jhw.vox.com/library/post/hey-ecuador.html?_c=feed-rss-full</comments>
            <guid isPermaLink="true">http://jhw.vox.com/library/post/hey-ecuador.html?_c=feed-rss-full</guid> 
            <pubDate>Tue, 10 Mar 2009 10:15:20 -0700</pubDate>         
            
            <description>    &lt;p&gt;I want my &lt;a href=&quot;http://torgo-x.livejournal.com/1112091.html&quot;&gt;coins&lt;/a&gt; back.&lt;/p&gt;    &lt;p style=&quot;clear:both;&quot;&gt; 
    &lt;a href=&quot;http://jhw.vox.com/library/post/hey-ecuador.html?_c=feed-rss-full#comments&quot;&gt;Read and post comments&lt;/a&gt;   |   
    &lt;a href=&quot;http://www.vox.com/share/6a00c225245f69f219011017b04894860e?_c=feed-rss-full&quot;&gt;Send to a friend&lt;/a&gt; 
&lt;/p&gt;
 
            </description> 
            <category domain="http://jhw.vox.com/tags/">rant</category> 
            <category domain="http://jhw.vox.com/tags/">currency</category>   
        </item> 
 
        <item>
            <title>Toward An Abstract Syntax</title>
            <link>http://jhw.vox.com/library/post/toward-an-abstract-syntax.html?_c=feed-rss-full</link>   
            <author>nobody@vox.com(j h woodyatt)</author>
            <comments>http://jhw.vox.com/library/post/toward-an-abstract-syntax.html?_c=feed-rss-full</comments>
            <guid isPermaLink="true">http://jhw.vox.com/library/post/toward-an-abstract-syntax.html?_c=feed-rss-full</guid> 
            <pubDate>Mon, 09 Mar 2009 18:43:12 -0700</pubDate>         
            
            <description>    &lt;p&gt;I continue to noodle around with an abstract syntax for types in my internal language. &amp;#160;(Sigh. &amp;#160;This is taking forever.) &amp;#160;Here&amp;#39;s what I&amp;#39;m looking at now:&lt;div&gt;&lt;br /&gt;&lt;blockquote class=&quot;webkit-indent-blockquote&quot; style=&quot;margin: 0 0 0 40px; border: none; padding: 0px;&quot;&gt;&lt;p&gt;τ ::= α | ν⟨σ⟩ | λ(σ)&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote class=&quot;webkit-indent-blockquote&quot; style=&quot;margin: 0 0 0 40px; border: none; padding: 0px;&quot;&gt;&lt;p&gt;σ ::= ∀δ,σ | ∃α,σ | τ,σ | ϵ&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote class=&quot;webkit-indent-blockquote&quot; style=&quot;margin: 0 0 0 40px; border: none; padding: 0px;&quot;&gt;&lt;p&gt;δ ::=&amp;#160;α |&amp;#160;α&amp;#160;= τ |&amp;#160;α &amp;gt; τ&lt;/p&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Explanation. &amp;#160;A type (τ) is either a named type variable (α), or a channel type of shape (σ) with either&amp;#160;λ- or ν- binding. &amp;#160;A shape (σ) is a list of universal quantifications, existential quantifications and type declarations terminated by the shape terminator code (ϵ), i.e. a channel that carries no types or values has type&amp;#160;ϵ. &amp;#160;The universal quantification is enriched with flexible (&amp;gt;) and rigid (=) constraints.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Some syntactic sugar is useful. &amp;#160;The trailing&amp;#160;ϵ in a shape can be elided from the bracketed expression in a&amp;#160;λ- or ν- type expression, i.e.&amp;#160;ν⟨α,β,ε⟩ can be written&amp;#160;ν⟨α,β⟩. &amp;#160;If the shape of a channel type expression has only one term before the&amp;#160;ε, then the brackets/parentheses may be elided, i.e.&amp;#160;λ(α,ε) can be written&amp;#160;λα.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I&amp;#39;m still going back and forth with myself over where the&amp;#160;λ&amp;#39;s and ν&amp;#39;s belong.&lt;/div&gt;&lt;/div&gt;&lt;/p&gt;    &lt;p style=&quot;clear:both;&quot;&gt; 
    &lt;a href=&quot;http://jhw.vox.com/library/post/toward-an-abstract-syntax.html?_c=feed-rss-full#comments&quot;&gt;Read and post comments&lt;/a&gt;   |   
    &lt;a href=&quot;http://www.vox.com/share/6a00c225245f69f219011017b00bec860e?_c=feed-rss-full&quot;&gt;Send to a friend&lt;/a&gt; 
&lt;/p&gt;
 
            </description> 
            <category domain="http://jhw.vox.com/tags/">computer science</category> 
            <category domain="http://jhw.vox.com/tags/">language design</category> 
            <category domain="http://jhw.vox.com/tags/">π-calculus</category>   
        </item> 
 
        <item>
            <title>Monads In The π-Calculus</title>
            <link>http://jhw.vox.com/library/post/monads-in-the-%CF%80-calculus.html?_c=feed-rss-full</link>   
            <author>nobody@vox.com(j h woodyatt)</author>
            <comments>http://jhw.vox.com/library/post/monads-in-the-%CF%80-calculus.html?_c=feed-rss-full</comments>
            <guid isPermaLink="true">http://jhw.vox.com/library/post/monads-in-the-%CF%80-calculus.html?_c=feed-rss-full</guid> 
            <pubDate>Mon, 09 Mar 2009 09:10:44 -0700</pubDate>         
            
            <description>    &lt;p&gt;While I was in the shower this morning, it occurred to me that I should make a note for myself about how &lt;a href=&quot;http://en.wikipedia.org/wiki/Monad_(functional_programming)&quot;&gt;monads&lt;/a&gt;&amp;#160;work in the polyadic D-fusion calculus.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;The &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: italic;&quot;&gt;type construction&lt;/span&gt; is simply a channel (να) for sending a value of the underlying type.&lt;/li&gt;&lt;li&gt;The &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: italic;&quot;&gt;unit function&lt;/span&gt; is a channel (να λ(λ(να))) for sending a value of the underlying type and receiving a responsive channel that carries the resulting monadic value.&lt;/li&gt;&lt;li&gt;The &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: italic;&quot;&gt;binding operation&lt;/span&gt; is a channel (να&amp;#160;ν(να λ(λ(νβ)))) λ(λ(νβ))) for sending two values, 1) a monadic value of type α and 2) a channel for sending a value of the underlying type α and receiving a responsive channel that carries the resulting value of monadic type β; the binding operation channel also permits receiving a responsive channel that carries the resulting value of monadic type β.&lt;/li&gt;&lt;/ul&gt;Easy as cake.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note: the process defined according to the type above for the binding operation always starts when both inputs are available. &amp;#160;There are two possible optimizations here: one where the process begins immediately when the value of monadic type α becomes available and one that begins immediately when the bound channel becomes available. &amp;#160;The description of these types is left as an exercise.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Update: I made some consistency errors in the first revision of this post, so I went back and edited it to correct errors.&lt;/div&gt;&lt;/p&gt;    &lt;p style=&quot;clear:both;&quot;&gt; 
    &lt;a href=&quot;http://jhw.vox.com/library/post/monads-in-the-%CF%80-calculus.html?_c=feed-rss-full#comments&quot;&gt;Read and post comments&lt;/a&gt;   |   
    &lt;a href=&quot;http://www.vox.com/share/6a00c225245f69f2190110180ee8c3860f?_c=feed-rss-full&quot;&gt;Send to a friend&lt;/a&gt; 
&lt;/p&gt;
 
            </description> 
            <category domain="http://jhw.vox.com/tags/">computer science</category> 
            <category domain="http://jhw.vox.com/tags/">language design</category> 
            <category domain="http://jhw.vox.com/tags/">π-calculus</category>   
        </item> 
    </channel>
</rss>

