<!-- 
RSS generated by JIRA (4.4#649-r158309) at Wed May 22 06:13:49 CDT 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://dev.clojure.org/jira/si/jira.issueviews:issue-xml/CLJ-129/CLJ-129.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Clojure JIRA</title>
    <link>http://dev.clojure.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>4.4</version>
        <build-number>649</build-number>
        <build-date>25-07-2011</build-date>
    </build-info>

<item>
            <title>[CLJ-129] Add documentation to sorted-set-by detailing how the provided comparator may change set membership semantics</title>
                <link>http://dev.clojure.org/jira/browse/CLJ-129</link>
                <project id="10010" key="CLJ">Clojure</project>
                        <description>&lt;p&gt;To start, let&apos;s look at some simple default sorted-set behaviour (which uses PersistentHashMap via PersistentHashSet, and therefore uses equality/hashCode to determine identity):&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;user=&amp;gt; (sorted-set [1 2] [-5 10] [1 5])
#{[-5 10] [1 2] [1 5]}
&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;

sorted-set-by uses PersistentTreeMap via PersistentTreeSet though, which implies that the comparator provided to sorted-set-by will be used to determine identity, and therefore member in the set.  This can lead to (IMO) non-intuitive behaviour:

&amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;
user=&amp;gt; (sorted-set-by #(&amp;gt; (first %) (first %2)) [1 2] [-5 10] [1 5])
#{[1 2] [-5 10]}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Notice that because the provided comparison fn determines that &lt;span class=&quot;error&quot;&gt;&amp;#91;1 2&amp;#93;&lt;/span&gt; and &lt;span class=&quot;error&quot;&gt;&amp;#91;1 5&amp;#93;&lt;/span&gt; have the same sort order, the latter value is considered identical to the former, and not included in the set.  This behaviour could be very handy, but is also likely to cause confusion when what the user almost certainly wants is to maintain the membership semantics of the original set (e.g. relying upon equality/hashCode), but only modify the ordering.&lt;/p&gt;

&lt;p&gt;(BTW, yes, I know there&apos;s far easier ways to get the order I&apos;m indicating above over a set of vectors thanks to vectors being comparable via the compare fn.  The examples are only meant to be illustrative.  The same non-intuitive result would occur, with no easy fallback (like the &apos;compare&apos; fn when working with vectors) when the members of the set are non-Comparable Java object, and the comparator provided to sorted-set-by is defining a sort over some values returned by method calls into those objects.)&lt;/p&gt;

&lt;p&gt;I&apos;d be happy to change the docs for sorted-set-by, but I suspect that there are others who could encapsulate what&apos;s going on here more correctly and more concisely than I.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13526">CLJ-129</key>
            <summary>Add documentation to sorted-set-by detailing how the provided comparator may change set membership semantics</summary>
                <type id="4" iconUrl="http://dev.clojure.org/jira/images/icons/improvement.gif">Enhancement</type>
                                        <status id="3" iconUrl="http://dev.clojure.org/jira/images/icons/status_inprogress.gif">In Progress</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="cemerick">Chas Emerick</assignee>
                                <reporter username="-1">None</reporter>
                        <labels>
                    </labels>
                <created>Thu, 18 Jun 2009 16:14:00 -0500</created>
                <updated>Tue, 24 Aug 2010 07:45:00 -0500</updated>
                                                    <fixVersion>Backlog</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="22903" author="importer" created="Tue, 24 Aug 2010 07:45:00 -0500"  >&lt;p&gt;Converted from &lt;a href=&quot;http://www.assembla.com/spaces/clojure/tickets/129&quot;&gt;http://www.assembla.com/spaces/clojure/tickets/129&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="22904" author="importer" created="Tue, 24 Aug 2010 07:45:00 -0500"  >&lt;p&gt;richhickey said: Updating tickets (#127, #128, #129, #130)&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                                                                            <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                                                                                            </customfields>
    </item>
</channel>
</rss>