<!-- 
RSS generated by JIRA (4.4#649-r158309) at Mon May 20 12:59:38 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-1052/CLJ-1052.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-1052] assoc should throw exception if missing val for last key</title>
                <link>http://dev.clojure.org/jira/browse/CLJ-1052</link>
                <project id="10010" key="CLJ">Clojure</project>
                        <description>&lt;p&gt;&lt;a href=&quot;https://groups.google.com/forum/?fromgroups=#!topic/clojure/k2R4OdPUCzg&quot;&gt;https://groups.google.com/forum/?fromgroups=#!topic/clojure/k2R4OdPUCzg&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Suggested by Ambrose Bonnaire-Sergeant:&lt;/p&gt;

&lt;p&gt;I think assoc should throw an error when applied with uneven arguments.&lt;/p&gt;

&lt;p&gt;Currently, the &quot;missing&quot; value is just replaced with nil.&lt;/p&gt;

&lt;p&gt;(assoc {} :a 1 :b)&lt;br/&gt;
;=&amp;gt; {:a 1, :b nil}&lt;/p&gt;</description>
                <environment></environment>
            <key id="15653">CLJ-1052</key>
            <summary>assoc should throw exception if missing val for last key</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</type>
                                <priority id="4" iconUrl="http://dev.clojure.org/jira/images/icons/priority_minor.gif">Minor</priority>
                    <status id="6" iconUrl="http://dev.clojure.org/jira/images/icons/status_closed.gif">Closed</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="-1">Unassigned</assignee>
                                <reporter username="jafingerhut">Andy Fingerhut</reporter>
                        <labels>
                    </labels>
                <created>Wed, 29 Aug 2012 16:40:24 -0500</created>
                <updated>Sat, 20 Oct 2012 09:53:42 -0500</updated>
                    <resolved>Sat, 20 Oct 2012 09:53:42 -0500</resolved>
                            <version>Release 1.2</version>
                <version>Release 1.3</version>
                <version>Release 1.4</version>
                                <fixVersion>Release 1.5</fixVersion>
                                        <due></due>
                    <votes>8</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="29286" author="jafingerhut" created="Wed, 29 Aug 2012 16:42:49 -0500"  >&lt;p&gt;Patch clj-1052-assoc-should-throw-exc-if-missing-val-patch1.txt dated Aug 29 2012 makes assoc throw an IllegalArgumentException if more than one key is given, but the last key has no value.  It includes a few simple test cases with correct and incorrect arguments to assoc.&lt;/p&gt;</comment>
                    <comment id="29287" author="ambrosebs" created="Wed, 29 Aug 2012 17:14:13 -0500"  >&lt;p&gt;IMO if the error message included something like &quot;assoc expects even number of arguments after target, found odd number&quot;, or some mention of the number of arguments the error would be clearer to me.&lt;/p&gt;</comment>
                    <comment id="29288" author="jafingerhut" created="Wed, 29 Aug 2012 18:06:59 -0500"  >&lt;p&gt;clj-1052-assoc-should-throw-exc-if-missing-val-patch2.txt is identical to the now-removed -patch1.txt, except for the text of the exception thrown, updated as per Ambrose&apos;s suggestion.&lt;/p&gt;</comment>
                    <comment id="29479" author="stu" created="Tue, 18 Sep 2012 06:51:53 -0500"  >&lt;p&gt;The patch appears correct. It does introduce a single extra (next) per iteration into the success path, although that seems unlikely to dominate the work. Wouldn&apos;t hurt to add as assessment showing this is no slower for correct programs.&lt;/p&gt;
</comment>
                    <comment id="29497" author="jafingerhut" created="Wed, 19 Sep 2012 02:03:45 -0500"  >&lt;p&gt;Test platform: Mac OS X 10.6.8 + Oracle/Apple Java 1.6.0_35 Java HotSpot(TM) 64-Bit Server VM&lt;/p&gt;

&lt;p&gt;With latest Clojure master as of Sep 19 2012:&lt;/p&gt;

&lt;p&gt;Clojure 1.5.0-master-SNAPSHOT&lt;br/&gt;
user=&amp;gt; (set! &lt;b&gt;unchecked-math&lt;/b&gt; true)&lt;br/&gt;
true&lt;br/&gt;
(defn count-maps &lt;span class=&quot;error&quot;&gt;&amp;#91;n&amp;#93;&lt;/span&gt;&lt;br/&gt;
  (let &lt;span class=&quot;error&quot;&gt;&amp;#91;base {:a 1}&amp;#93;&lt;/span&gt;&lt;br/&gt;
    (loop [i n&lt;br/&gt;
           sum 0]&lt;br/&gt;
      (if (zero? i)&lt;br/&gt;
        sum&lt;br/&gt;
        (let &lt;span class=&quot;error&quot;&gt;&amp;#91;m1 (assoc base :b 2 :c 3 :d 4 :e 5 :f 6 :g 7 :h 8 :i 9 :j 10)&amp;#93;&lt;/span&gt;&lt;br/&gt;
          (recur (dec i) (+ sum (count m1))))))))&lt;br/&gt;
#&apos;user/count-maps&lt;br/&gt;
user=&amp;gt; (time (count-maps 10000000))&lt;br/&gt;
&quot;Elapsed time: 48784.077 msecs&quot;&lt;br/&gt;
100000000&lt;br/&gt;
user=&amp;gt; (time (count-maps 10000000))&lt;br/&gt;
&quot;Elapsed time: 49028.52 msecs&quot;&lt;br/&gt;
100000000&lt;br/&gt;
user=&amp;gt; (time (count-maps 10000000))&lt;br/&gt;
&quot;Elapsed time: 50314.729 msecs&quot;&lt;br/&gt;
100000000&lt;/p&gt;

&lt;p&gt;Same Clojure version, plus the patch that was screened:&lt;/p&gt;

&lt;p&gt;user=&amp;gt; (time (count-maps 10000000))&lt;br/&gt;
&quot;Elapsed time: 49576.191 msecs&quot;&lt;br/&gt;
100000000&lt;br/&gt;
user=&amp;gt; (time (count-maps 10000000))&lt;br/&gt;
&quot;Elapsed time: 49957.866 msecs&quot;&lt;br/&gt;
100000000&lt;br/&gt;
user=&amp;gt; (time (count-maps 10000000))&lt;br/&gt;
&quot;Elapsed time: 52149.998 msecs&quot;&lt;br/&gt;
100000000&lt;/p&gt;

&lt;p&gt;(average of 3 times after patch) / (average of 3 times before patch) = 1.0240&lt;/p&gt;

&lt;p&gt;So 2.4% slowdown on average for that test case.  I should add that I&apos;m not a statistician, but note that this 2.4% difference is less than the variation in run time from one run to the next of the same experiment.  Likely any real statistician would recommend collecting a lot more data before asserting there is a change in performance.&lt;/p&gt;</comment>
                    <comment id="29601" author="jafingerhut" created="Fri, 5 Oct 2012 07:38:05 -0500"  >&lt;p&gt;clj-1052-assoc-should-throw-exc-if-missing-val-patch3.txt dated Oct 5 2012 is the same as the previous patch clj-1052-assoc-should-throw-exc-if-missing-val-patch2.txt dated Aug 29 2012 except some context lines have been updated so that it applies cleanly using git.  The older version will be removed in a minute.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11536" name="clj-1052-assoc-should-throw-exc-if-missing-val-patch3.txt" size="1816" author="jafingerhut" created="Fri, 5 Oct 2012 07:38:05 -0500" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                <customfield id="customfield_10002" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Approval</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10007">Ok</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                    <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                            <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Patch</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10002">Code and Test</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                        </customfields>
    </item>
</channel>
</rss>