<?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: Currying in Smalltalk, part 2</title>
	<atom:link href="http://blog.3plus4.org/2007/03/24/currying-in-smalltalk-part-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.3plus4.org/2007/03/24/currying-in-smalltalk-part-2/</link>
	<description>The neighbourhood of 7</description>
	<lastBuildDate>Wed, 11 Nov 2009 12:08:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Vassili Bykov</title>
		<link>http://blog.3plus4.org/2007/03/24/currying-in-smalltalk-part-2/comment-page-1/#comment-11</link>
		<dc:creator>Vassili Bykov</dc:creator>
		<pubDate>Tue, 27 Mar 2007 05:10:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/2007/03/24/currying-in-smalltalk-part-2/#comment-11</guid>
		<description>The alternatives show very well what currying (or in fact, multi-argument functions and their applications in general) is all about. If you imagine a system where blocks can only have one argument, you could implement multi-argument blocks by nesting, just like in your last example 

[:a1 :a2 ... aN &#124; ...] =&gt;  [:a1 [:a2 [... [:aN &#124; ... ]]]]

and rewriting every block invocation as nested &#039;value:&#039; message sends

aBlock value: a value: b value: c =&gt; ((aBlock value: a) value: b ) value: c

The messages gradually &quot;unwrap&quot; the block. If there are enough of them, you end up running the inner block as in a &quot;regular&quot; block invocation. If not enough, you are left with a closure for the remaining layers, with the arguments provided so far captured in the closure&#039;s environment.</description>
		<content:encoded><![CDATA[<p>The alternatives show very well what currying (or in fact, multi-argument functions and their applications in general) is all about. If you imagine a system where blocks can only have one argument, you could implement multi-argument blocks by nesting, just like in your last example </p>
<p>[:a1 :a2 ... aN | ...] =>  [:a1 [:a2 [... [:aN | ... ]]]]</p>
<p>and rewriting every block invocation as nested &#8216;value:&#8217; message sends</p>
<p>aBlock value: a value: b value: c => ((aBlock value: a) value: b ) value: c</p>
<p>The messages gradually &#8220;unwrap&#8221; the block. If there are enough of them, you end up running the inner block as in a &#8220;regular&#8221; block invocation. If not enough, you are left with a closure for the remaining layers, with the arguments provided so far captured in the closure&#8217;s environment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Björn</title>
		<link>http://blog.3plus4.org/2007/03/24/currying-in-smalltalk-part-2/comment-page-1/#comment-10</link>
		<dc:creator>Björn</dc:creator>
		<pubDate>Mon, 26 Mar 2007 10:48:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/2007/03/24/currying-in-smalltalk-part-2/#comment-10</guid>
		<description>What comes to my mind is
If you want to define derivation by means of blocks you can do it as follows:
df := [:f :x :h &#124; (f value: x + h) - (f value: x) / h].
func := [:x &#124; x ** 3].
df value: func value: 4711 value: 1000000 reciprocal

Or you can use some kind of more explicit cyrrying (if one should call it currying...)
curry := [:f &#124;  [:x :h &#124; (f value: x + h) - (f value: x) / h].].
cyrryDf := curryvalue: [:x &#124; x ** 3] .
cyrryDf value: 4 value: 100000000000 reciprocal

In this way the add example in the text could be written
&#124; add inc &#124;
add := [:x &#124; [:a :b  &#124; (a + x) + (b + x)]].
inc := add value: 1.
inc value: 2 value: 3

Of course one has to bind both a and b simultaneously.
Or rewrite the thing as
&#124; add inc &#124;
add := [:x &#124; [:a &#124; [:b &#124; (a + x) + (b + x)]]].
inc := add value: 1.
inc := inc value: 2.
inc value: 3

Any comments on these more explicit alternatives?</description>
		<content:encoded><![CDATA[<p>What comes to my mind is<br />
If you want to define derivation by means of blocks you can do it as follows:<br />
df := [:f :x :h | (f value: x + h) - (f value: x) / h].<br />
func := [:x | x ** 3].<br />
df value: func value: 4711 value: 1000000 reciprocal</p>
<p>Or you can use some kind of more explicit cyrrying (if one should call it currying&#8230;)<br />
curry := [:f |  [:x :h | (f value: x + h) - (f value: x) / h].].<br />
cyrryDf := curryvalue: [:x | x ** 3] .<br />
cyrryDf value: 4 value: 100000000000 reciprocal</p>
<p>In this way the add example in the text could be written<br />
| add inc |<br />
add := [:x | [:a :b  | (a + x) + (b + x)]].<br />
inc := add value: 1.<br />
inc value: 2 value: 3</p>
<p>Of course one has to bind both a and b simultaneously.<br />
Or rewrite the thing as<br />
| add inc |<br />
add := [:x | [:a | [:b | (a + x) + (b + x)]]].<br />
inc := add value: 1.<br />
inc := inc value: 2.<br />
inc value: 3</p>
<p>Any comments on these more explicit alternatives?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vassili Bykov</title>
		<link>http://blog.3plus4.org/2007/03/24/currying-in-smalltalk-part-2/comment-page-1/#comment-9</link>
		<dc:creator>Vassili Bykov</dc:creator>
		<pubDate>Sat, 24 Mar 2007 19:35:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/2007/03/24/currying-in-smalltalk-part-2/#comment-9</guid>
		<description>Yep, you are onto something here, and there will be chapters 3 and 4 at least. :) I&#039;m now in a middle of a move though, so I can&#039;t promise a chapter a day...</description>
		<content:encoded><![CDATA[<p>Yep, you are onto something here, and there will be chapters 3 and 4 at least. :) I&#8217;m now in a middle of a move though, so I can&#8217;t promise a chapter a day&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Travis Griggs</title>
		<link>http://blog.3plus4.org/2007/03/24/currying-in-smalltalk-part-2/comment-page-1/#comment-7</link>
		<dc:creator>Travis Griggs</dc:creator>
		<pubDate>Sat, 24 Mar 2007 18:37:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3plus4.org/2007/03/24/currying-in-smalltalk-part-2/#comment-7</guid>
		<description>So while this is really cool... what&#039;s it good for Vassili? I&#039;m asking a leading question here. :)

I think currying remains a term reserved to &quot;computer theory geeks.&quot; Doing 3 + 4 in a way that looks like (2 + 1) + (3 + 1) -&gt; 7 is lost on the unwashed masses. It&#039;s like telling people that Seaside is cool because it&#039;s based on continuations, and leaving it at that. So how &#039;bout a &quot;chapter 3&quot; showing a case where the how to use this for normal programming is illustrated by example?</description>
		<content:encoded><![CDATA[<p>So while this is really cool&#8230; what&#8217;s it good for Vassili? I&#8217;m asking a leading question here. :)</p>
<p>I think currying remains a term reserved to &#8220;computer theory geeks.&#8221; Doing 3 + 4 in a way that looks like (2 + 1) + (3 + 1) -&gt; 7 is lost on the unwashed masses. It&#8217;s like telling people that Seaside is cool because it&#8217;s based on continuations, and leaving it at that. So how &#8217;bout a &#8220;chapter 3&#8243; showing a case where the how to use this for normal programming is illustrated by example?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
