<!-- 
RSS generated by JIRA (4.4#649-r158309) at Wed May 22 15:57:07 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-950/CLJ-950.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-950] Function literals behavior differ from that of fns</title>
                <link>http://dev.clojure.org/jira/browse/CLJ-950</link>
                <project id="10010" key="CLJ">Clojure</project>
                        <description>&lt;p&gt;	((fn [] true)) ; true&lt;br/&gt;
	(#(true)) ; classcast exception&lt;/p&gt;

&lt;p&gt;	((fn [])) ; nil&lt;br/&gt;
	(#()) ; ()&lt;/p&gt;

&lt;p&gt;	(some (fn &lt;span class=&quot;error&quot;&gt;&amp;#91;_&amp;#93;&lt;/span&gt;_) &lt;span class=&quot;error&quot;&gt;&amp;#91;nil false 0 1&amp;#93;&lt;/span&gt;) ; 0&lt;br/&gt;
	(some #(%) &lt;span class=&quot;error&quot;&gt;&amp;#91;nil false 0 1&amp;#93;&lt;/span&gt;) ; NPE&lt;/p&gt;</description>
                <environment></environment>
            <key id="15270">CLJ-950</key>
            <summary>Function literals behavior differ from that of fns</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</type>
                                <priority id="3" iconUrl="http://dev.clojure.org/jira/images/icons/priority_major.gif">Major</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="vemv">V&#237;ctor M. Valenzuela</reporter>
                        <labels>
                        <label>reader</label>
                    </labels>
                <created>Thu, 8 Mar 2012 06:13:29 -0600</created>
                <updated>Fri, 1 Mar 2013 12:46:59 -0600</updated>
                    <resolved>Thu, 8 Mar 2012 12:28:16 -0600</resolved>
                                                                    <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="27914" author="tsdh" created="Thu, 8 Mar 2012 12:27:36 -0600"  >&lt;p&gt;This is no defect.  Function literals must have a function (or macro or special form) as first symbol.&lt;br/&gt;
So your examples should be written like so:&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; (#(do true))
true
user&amp;gt; (#(do))
nil
user&amp;gt; (some #(do %) [nil false 0 1])
0
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="27915" author="vemv" created="Thu, 8 Mar 2012 14:10:31 -0600"  >&lt;p&gt;It makes sense. However (and correct me if I&apos;m wrong) there should be little problem in making them fully equivalent to fns, resulting in a more concise and consistent API.&lt;/p&gt;

&lt;p&gt;Please consider re-opening the issue as a feature request.&lt;/p&gt;

&lt;p&gt;Regards - V&#237;ctor.&lt;/p&gt;</comment>
                    <comment id="27917" author="tsdh" created="Fri, 9 Mar 2012 01:26:53 -0600"  >&lt;p&gt;The reader docs at &lt;a href=&quot;http://www.clojure.org/reader&quot;&gt;http://www.clojure.org/reader&lt;/a&gt; say that #() is not a replacement for (fn [] ...).  You can&apos;t make it more equivalent to fn without making it much harder to understand.  Let me explain that with an example.&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;(defn get-time []
  (System/currentTimeMillis))

(#(get-time)) ;; What&apos;s the result?
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;What&apos;s the result of the funcall above?  Clearly, right now, it is the current system time.&lt;/p&gt;

&lt;p&gt;So if we decided to allow to write #(true) as an alternative to (constantly true) &lt;span class=&quot;error&quot;&gt;&amp;#91;which is a varargs fn&amp;#93;&lt;/span&gt; or #(do true) &lt;span class=&quot;error&quot;&gt;&amp;#91;which is a fn of zero args&amp;#93;&lt;/span&gt;, then valid values of #(get-time) where both the current system time but also the function object for get-time.  Functions are values, too.&lt;/p&gt;

&lt;p&gt;Ok, one could say that in the case of a function, #(function) is always a call, but it would make it harder to reason about what the code does for not much benefit.&lt;/p&gt;</comment>
                    <comment id="27918" author="vemv" created="Fri, 9 Mar 2012 07:56:44 -0600"  >&lt;p&gt;You&apos;re right - satisfying my request would require to change the average use of this feature to &lt;tt&gt;#((some_fn %1 %2))&lt;/tt&gt; rather than just &lt;tt&gt;#(some_fn %1 %2)&lt;/tt&gt;, if we wanted &lt;tt&gt;#(true)&lt;/tt&gt; to be valid. Which indeed would be barely handy.&lt;/p&gt;

&lt;p&gt;Thank you.&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>