<?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"
	>
<channel>
	<title>Comments on: Continuation monad in Scala</title>
	<atom:link href="http://blog.tmorris.net/continuation-monad-in-scala/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tmorris.net/continuation-monad-in-scala/</link>
	<description>The weblog of Tony Morris</description>
	<pubDate>Sat, 04 Feb 2012 12:49:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: λ Tony’s blog λ &#187; Blog Archive &#187; Nothing returns anything, ever!</title>
		<link>http://blog.tmorris.net/continuation-monad-in-scala/#comment-57656</link>
		<dc:creator>λ Tony’s blog λ &#187; Blog Archive &#187; Nothing returns anything, ever!</dc:creator>
		<pubDate>Tue, 28 Dec 2010 09:39:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tmorris.net/?p=512#comment-57656</guid>
		<description>[...] another battle  Further, there are some interesting properties about continuations, in particular, they are a a monad, perhaps even the mother of all monads, but we&#8217;ll leave all that for another day [...]</description>
		<content:encoded><![CDATA[<p>[...] another battle  Further, there are some interesting properties about continuations, in particular, they are a a monad, perhaps even the mother of all monads, but we&#8217;ll leave all that for another day [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://blog.tmorris.net/continuation-monad-in-scala/#comment-29940</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Mon, 26 Jan 2009 21:26:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tmorris.net/?p=512#comment-29940</guid>
		<description>Is it possible to express something like the following Scheme snippet with this continuation formulation?

&lt;code&gt;
(+ 1 (call/cc
&#160;&#160;&#160;(lambda (k)
&#160;&#160;&#160;(+ 2 (k 4)))))
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Is it possible to express something like the following Scheme snippet with this continuation formulation?</p>
<p><code><br />
(+ 1 (call/cc<br />
&nbsp;&nbsp;&nbsp;(lambda (k)<br />
&nbsp;&nbsp;&nbsp;(+ 2 (k 4)))))<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony Morris</title>
		<link>http://blog.tmorris.net/continuation-monad-in-scala/#comment-27223</link>
		<dc:creator>Tony Morris</dc:creator>
		<pubDate>Sat, 03 Jan 2009 21:34:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tmorris.net/?p=512#comment-27223</guid>
		<description>Thanks Martin, I wasn't aware of Responder. It looks like Responder applies the first type parameter of my example as &lt;code&gt;Unit&lt;/code&gt;. That is, &lt;code&gt;Continuation[Unit, A]&lt;/code&gt; ~= &lt;code&gt;Responder[A]&lt;/code&gt;.</description>
		<content:encoded><![CDATA[<p>Thanks Martin, I wasn&#8217;t aware of Responder. It looks like Responder applies the first type parameter of my example as <code>Unit</code>. That is, <code>Continuation[Unit, A]</code> ~= <code>Responder[A]</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://blog.tmorris.net/continuation-monad-in-scala/#comment-27211</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Sat, 03 Jan 2009 16:18:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tmorris.net/?p=512#comment-27211</guid>
		<description>Hi Tony,

Not sure whether this is known: There is something very similar to what you describe in Scala's standard library: It's called Responder, and it is in the scala package.

Cheers

 -- Martin</description>
		<content:encoded><![CDATA[<p>Hi Tony,</p>
<p>Not sure whether this is known: There is something very similar to what you describe in Scala&#8217;s standard library: It&#8217;s called Responder, and it is in the scala package.</p>
<p>Cheers</p>
<p> &#8212; Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vadim</title>
		<link>http://blog.tmorris.net/continuation-monad-in-scala/#comment-26734</link>
		<dc:creator>Vadim</dc:creator>
		<pubDate>Mon, 29 Dec 2008 10:46:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tmorris.net/?p=512#comment-26734</guid>
		<description>Thanks, I finally got it )</description>
		<content:encoded><![CDATA[<p>Thanks, I finally got it )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony Morris</title>
		<link>http://blog.tmorris.net/continuation-monad-in-scala/#comment-26699</link>
		<dc:creator>Tony Morris</dc:creator>
		<pubDate>Mon, 29 Dec 2008 01:26:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tmorris.net/?p=512#comment-26699</guid>
		<description>Hi Vadim,
It doesn't get evaluated because the continuation acts as a function to the value. It is when that function's arguments are applied that all the evaluation occurs.

Consider this simple Java snippet:

&lt;pre lang="Java"&gt;
int method() {
  return a + b;
}
&lt;/pre&gt;

This is slightly different to:

&lt;pre lang="Java"&gt;
int method = a + b;
&lt;/pre&gt;

This is because of the evaluation semantics. The use of the &lt;code&gt;def&lt;/code&gt; keyword in Scala effectively makes the code like the former (while &lt;code&gt;val&lt;/code&gt; would make it like the latter).

I hope this helps.</description>
		<content:encoded><![CDATA[<p>Hi Vadim,<br />
It doesn&#8217;t get evaluated because the continuation acts as a function to the value. It is when that function&#8217;s arguments are applied that all the evaluation occurs.</p>
<p>Consider this simple Java snippet:</p>

<div class="wp_syntax"><div class="code"><pre class="java"><span style="color: #000066; font-weight: bold;">int</span> method<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">return</span> a <span style="color: #339933;">+</span> b<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This is slightly different to:</p>

<div class="wp_syntax"><div class="code"><pre class="java"><span style="color: #000066; font-weight: bold;">int</span> method <span style="color: #339933;">=</span> a <span style="color: #339933;">+</span> b<span style="color: #339933;">;</span></pre></div></div>

<p>This is because of the evaluation semantics. The use of the <code>def</code> keyword in Scala effectively makes the code like the former (while <code>val</code> would make it like the latter).</p>
<p>I hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vadim</title>
		<link>http://blog.tmorris.net/continuation-monad-in-scala/#comment-26688</link>
		<dc:creator>Vadim</dc:creator>
		<pubDate>Sun, 28 Dec 2008 22:52:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tmorris.net/?p=512#comment-26688</guid>
		<description>Hey, great examples. If only I could understand them as easily as you seem to be writing. I'm fairly new to Scala (it's been a week) and this example you provided (squares), which is supposed to be trivial by your measures, confuses me even after an hour of beating my head against the interpreter. 

Why doesn't &lt;code&gt;square(n)&lt;/code&gt; in &lt;code&gt;def squarec[R](n: Int) = unit[R](square(n))&lt;/code&gt; get evaluated immediately after &lt;code&gt;squarec[Unit](n)&lt;/code&gt; is called? Instead, it gets evaluated 2 times upon the last call to the resulting Continuation .apply (&lt;code&gt;k(println)&lt;/code&gt;), before executing the function supplied to the .apply (&lt;code&gt;println&lt;/code&gt;).

I'm sure it's something very simple, but it's driving me nuts.</description>
		<content:encoded><![CDATA[<p>Hey, great examples. If only I could understand them as easily as you seem to be writing. I&#8217;m fairly new to Scala (it&#8217;s been a week) and this example you provided (squares), which is supposed to be trivial by your measures, confuses me even after an hour of beating my head against the interpreter. </p>
<p>Why doesn&#8217;t <code>square(n)</code> in <code>def squarec[R](n: Int) = unit[R](square(n))</code> get evaluated immediately after <code>squarec[Unit](n)</code> is called? Instead, it gets evaluated 2 times upon the last call to the resulting Continuation .apply (<code>k(println)</code>), before executing the function supplied to the .apply (<code>println</code>).</p>
<p>I&#8217;m sure it&#8217;s something very simple, but it&#8217;s driving me nuts.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

