<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Clojure: The &#039;apply&#039; function</title>
	<atom:link href="http://www.markhneedham.com/blog/2009/11/25/clojure-the-apply-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2009/11/25/clojure-the-apply-function/</link>
	<description>Thoughts on Software Development</description>
	<lastBuildDate>Fri, 12 Mar 2010 09:24:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Rafał Dowgird</title>
		<link>http://www.markhneedham.com/blog/2009/11/25/clojure-the-apply-function/comment-page-1/#comment-32874</link>
		<dc:creator>Rafał Dowgird</dc:creator>
		<pubDate>Thu, 04 Mar 2010 12:07:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1874#comment-32874</guid>
		<description>@Thomas: &quot;I always thought apply was the same as (eval (cons f args))&quot;

An important implication of the above article is that apply is lazy with respect to args. (apply (constantly 7) (repeat 1)) evaluates to 7 even though the args list is infinite. The eval-cons cannot do that.</description>
		<content:encoded><![CDATA[<p>@Thomas: "I always thought apply was the same as (eval (cons f args))"</p>
<p>An important implication of the above article is that apply is lazy with respect to args. (apply (constantly 7) (repeat 1)) evaluates to 7 even though the args list is infinite. The eval-cons cannot do that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian McKeough</title>
		<link>http://www.markhneedham.com/blog/2009/11/25/clojure-the-apply-function/comment-page-1/#comment-27254</link>
		<dc:creator>Brian McKeough</dc:creator>
		<pubDate>Thu, 26 Nov 2009 02:35:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1874#comment-27254</guid>
		<description>Thanks, you inspired me to look at the innards of Clojure in a way I hadn&#039;t before.  

It appears to me that str is itself compiled into an IFun instance (actually two, one extending AFunction and one extending RestFn).  Look for (and decompile) core$str* in the clojure.jar.  Each of these implement &quot;invoke&quot; according to the logic of str.  At this point I frankly don&#039;t understand why there are the two different classes.

As you and Ola already indicated &quot;invoke&quot; is called by applyTo.  I believe AFn (AFunction&#039;s parent class) implements applyTo as a call to this.invoke with the appropriate parameter count.</description>
		<content:encoded><![CDATA[<p>Thanks, you inspired me to look at the innards of Clojure in a way I hadn't before.  </p>
<p>It appears to me that str is itself compiled into an IFun instance (actually two, one extending AFunction and one extending RestFn).  Look for (and decompile) core$str* in the clojure.jar.  Each of these implement "invoke" according to the logic of str.  At this point I frankly don't understand why there are the two different classes.</p>
<p>As you and Ola already indicated "invoke" is called by applyTo.  I believe AFn (AFunction's parent class) implements applyTo as a call to this.invoke with the appropriate parameter count.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Winant</title>
		<link>http://www.markhneedham.com/blog/2009/11/25/clojure-the-apply-function/comment-page-1/#comment-27231</link>
		<dc:creator>Thomas Winant</dc:creator>
		<pubDate>Wed, 25 Nov 2009 14:12:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1874#comment-27231</guid>
		<description>I always thought apply was the same as (eval (cons f args))</description>
		<content:encoded><![CDATA[<p>I always thought apply was the same as (eval (cons f args))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/11/25/clojure-the-apply-function/comment-page-1/#comment-27213</link>
		<dc:creator>Mark Needham</dc:creator>
		<pubDate>Wed, 25 Nov 2009 05:50:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1874#comment-27213</guid>
		<description>Yeah that&#039;s right as far as I can see but then inside the &#039;applyTo&#039; method there seems to be a call to &#039;fn.invoke()&#039; which I&#039;m assuming calls the Clojure function?</description>
		<content:encoded><![CDATA[<p>Yeah that's right as far as I can see but then inside the 'applyTo' method there seems to be a call to 'fn.invoke()' which I'm assuming calls the Clojure function?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ola Bini</title>
		<link>http://www.markhneedham.com/blog/2009/11/25/clojure-the-apply-function/comment-page-1/#comment-27212</link>
		<dc:creator>Ola Bini</dc:creator>
		<pubDate>Wed, 25 Nov 2009 05:27:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1874#comment-27212</guid>
		<description>Actually, the magic in the apply method is [#^clojure.lang.IFn f &amp; args] which (I&#039;m pretty sure) is a type assertion. The . is a Java method call, and applyTo is a method defined on IFn, which is the common interface for all functions in Clojure - so that means Java integration is used to do str.applyTo(seq([1 2 3]))</description>
		<content:encoded><![CDATA[<p>Actually, the magic in the apply method is [#^clojure.lang.IFn f &amp; args] which (I'm pretty sure) is a type assertion. The . is a Java method call, and applyTo is a method defined on IFn, which is the common interface for all functions in Clojure &#8211; so that means Java integration is used to do str.applyTo(seq([1 2 3]))</p>
]]></content:encoded>
	</item>
</channel>
</rss>
