<!-- 
RSS generated by JIRA (4.4#649-r158309) at Mon May 20 04:06:09 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-877/CLJ-877.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-877] contains? is broken for vectors</title>
                <link>http://dev.clojure.org/jira/browse/CLJ-877</link>
                <project id="10010" key="CLJ">Clojure</project>
                        <description>&lt;p&gt;contains? returns the wrong result for the last item in a vector:&lt;/p&gt;

&lt;p&gt;user&amp;gt; (map #(contains? &lt;span class=&quot;error&quot;&gt;&amp;#91;1 2 3 4&amp;#93;&lt;/span&gt; %) &lt;span class=&quot;error&quot;&gt;&amp;#91;1 2 3 4&amp;#93;&lt;/span&gt;)&lt;br/&gt;
(true true true false)&lt;/p&gt;</description>
                <environment>OSX Lion</environment>
            <key id="15008">CLJ-877</key>
            <summary>contains? is broken for vectors</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</type>
                                <priority id="2" iconUrl="http://dev.clojure.org/jira/images/icons/priority_critical.gif">Critical</priority>
                    <status id="6" iconUrl="http://dev.clojure.org/jira/images/icons/status_closed.gif">Closed</status>
                    <resolution id="2">Declined</resolution>
                                <assignee username="-1">Unassigned</assignee>
                                <reporter username="jpalmucci">Jeff Palmucci</reporter>
                        <labels>
                    </labels>
                <created>Mon, 14 Nov 2011 12:23:07 -0600</created>
                <updated>Mon, 14 Nov 2011 12:45:35 -0600</updated>
                    <resolved>Mon, 14 Nov 2011 12:42:00 -0600</resolved>
                            <version>Release 1.3</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="27296" author="steveminer@gmail.com" created="Mon, 14 Nov 2011 12:41:18 -0600"  >&lt;p&gt;This is not a bug.  Check the doc &amp;#8211; contains? refers to the keys of the collection, not the values.  For a vector, the &quot;keys&quot; are the indices.  &lt;/p&gt;

&lt;p&gt;user=&amp;gt;  (map #(contains? &lt;span class=&quot;error&quot;&gt;&amp;#91;10 20 30 40&amp;#93;&lt;/span&gt; %) (range 4))&lt;br/&gt;
(true true true true)&lt;/p&gt;</comment>
                    <comment id="27297" author="bsmith.occs@gmail.com" created="Mon, 14 Nov 2011 12:45:35 -0600"  >&lt;p&gt;This is a (common) misusing of &lt;tt&gt;contains?&lt;/tt&gt;. Perhaps it would have been better if &lt;tt&gt;contains?&lt;/tt&gt; had been named &lt;tt&gt;contains-key?&lt;/tt&gt;, but that ship has sailed.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Usage: (contains? coll key)&lt;/p&gt;

&lt;p&gt;Returns true if key is present in the given collection, otherwise returns false.  Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. &apos;contains?&apos; operates constant or logarithmic time; it will not perform a linear search for a value.  See also &apos;some&apos;.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;A vector of length 4 has four keys (indexes): 0, 1, 2, 3, which is why your example is returning (true true true false).&lt;/p&gt;

&lt;p&gt;To get the behavior your are expecting from &lt;tt&gt;contains?&lt;/tt&gt;, use &lt;tt&gt;some&lt;/tt&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Usage: (some pred coll)&lt;/p&gt;

&lt;p&gt;Returns the first logical true value of (pred x) for any x in coll, else nil.  One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)&lt;/p&gt;&lt;/blockquote&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;user&amp;gt; (map #(some #{%} [1 2 3 4]) [1 2 3 4])
(1 2 3 4) ; all of which are truthy
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you prefer booleans, you could do something like this:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;user&amp;gt; (map (comp boolean #(some #{%} [1 2 3 4])) [1 2 3 4])
(true true true true)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&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>