<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments for Desi Founder @ Work</title>
	<link>http://sharjeel.2scomplement.com</link>
	<description>Journal of a Pakistani Tech Entrepreneur</description>
	<pubDate>Thu, 20 Nov 2008 22:01:14 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>Comment on Recursion, Misunderstood by sharjeel</title>
		<link>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-522</link>
		<dc:creator>sharjeel</dc:creator>
		<pubDate>Mon, 27 Oct 2008 16:15:37 +0000</pubDate>
		<guid>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-522</guid>
		<description>@m:
I'm not discouraging, I'm just making a distinction to make things clear.

@Stas Shtin:
Thanks for pointing out. I hastly wrote the code earlier. I've updated it now.

@ben, notyouravgjoel
You are right in your own perspective but I'm viewing it from language agnostic point of view.

@y:
Can you please be more specific to englighten me

@Ned Batchelder:
Thanks for enlighting everyone.</description>
		<content:encoded><![CDATA[<p>@m:<br />
I&#8217;m not discouraging, I&#8217;m just making a distinction to make things clear.</p>
<p>@Stas Shtin:<br />
Thanks for pointing out. I hastly wrote the code earlier. I&#8217;ve updated it now.</p>
<p>@ben, notyouravgjoel<br />
You are right in your own perspective but I&#8217;m viewing it from language agnostic point of view.</p>
<p>@y:<br />
Can you please be more specific to englighten me</p>
<p>@Ned Batchelder:<br />
Thanks for enlighting everyone.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Recursion, Misunderstood by ben</title>
		<link>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-518</link>
		<dc:creator>ben</dc:creator>
		<pubDate>Sun, 26 Oct 2008 01:53:43 +0000</pubDate>
		<guid>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-518</guid>
		<description>bm: I went and read section 1.2.1 of SICP as recommended in the reddit comments and the distinction between forms of functions and processes makes more sense now.  Thanks to you and Sharjeel for a most profitable morning :)

The paragraph that I found most enlightening was

The contrast between the two processes can be seen in another way. In the iterative case, the program variables provide a complete description of the state of the process at any point. If we stopped the computation between steps, all we would need to do to resume the computation is to supply the interpreter with the values of the three program variables. Not so with the recursive process. In this case there is some additional ``hidden'' information, maintained by the interpreter and not contained in the program variables, which indicates ``where the process is'' in negotiating the chain of deferred operations. The longer the chain, the more information must be maintained.</description>
		<content:encoded><![CDATA[<p>bm: I went and read section 1.2.1 of SICP as recommended in the reddit comments and the distinction between forms of functions and processes makes more sense now.  Thanks to you and Sharjeel for a most profitable morning :)</p>
<p>The paragraph that I found most enlightening was</p>
<p>The contrast between the two processes can be seen in another way. In the iterative case, the program variables provide a complete description of the state of the process at any point. If we stopped the computation between steps, all we would need to do to resume the computation is to supply the interpreter with the values of the three program variables. Not so with the recursive process. In this case there is some additional &#8220;hidden&#8221; information, maintained by the interpreter and not contained in the program variables, which indicates &#8220;where the process is&#8221; in negotiating the chain of deferred operations. The longer the chain, the more information must be maintained.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Recursion, Misunderstood by Ned Batchelder</title>
		<link>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-517</link>
		<dc:creator>Ned Batchelder</dc:creator>
		<pubDate>Sat, 25 Oct 2008 22:35:41 +0000</pubDate>
		<guid>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-517</guid>
		<description>You might want to read Structure and Interpretation of Computer Programs, section 1.2.1.  There they make a clear distinction between recursive processes and recursive procedures.  By their definition, both your fact and facti are recursive procedures.  But fact is a recursive process and facti is an iterative process.

To quote them:

"In contrasting iteration and recursion, we must be careful not to confuse the notion of recursive process with the notion of a recursive procedure.  When we describe a procedure as recursive, we are referring to the syntactic fact that the procedure [calls] itself. But when we describe a process [as recursive], we are speaking about how the process evolves, not about the syntax of how a procedure is written."</description>
		<content:encoded><![CDATA[<p>You might want to read Structure and Interpretation of Computer Programs, section 1.2.1.  There they make a clear distinction between recursive processes and recursive procedures.  By their definition, both your fact and facti are recursive procedures.  But fact is a recursive process and facti is an iterative process.</p>
<p>To quote them:</p>
<p>&#8220;In contrasting iteration and recursion, we must be careful not to confuse the notion of recursive process with the notion of a recursive procedure.  When we describe a procedure as recursive, we are referring to the syntactic fact that the procedure [calls] itself. But when we describe a process [as recursive], we are speaking about how the process evolves, not about the syntax of how a procedure is written.&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Recursion, Misunderstood by rpdillon</title>
		<link>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-516</link>
		<dc:creator>rpdillon</dc:creator>
		<pubDate>Sat, 25 Oct 2008 22:17:23 +0000</pubDate>
		<guid>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-516</guid>
		<description>OP is in no way "inventing his own" definition of recursion, as y implied.  As bm said, recursion is a property of the behavior of the algorithm, not an artifact of how that behavior is described.

As I said in the Reddit thread on this topic, if you'd like some background on what sharjeel is talking about, check section 1.2.1 in SICP, where it is made quite clear that the behavior of an algorithm as quite distinct from it's description.</description>
		<content:encoded><![CDATA[<p>OP is in no way &#8220;inventing his own&#8221; definition of recursion, as y implied.  As bm said, recursion is a property of the behavior of the algorithm, not an artifact of how that behavior is described.</p>
<p>As I said in the Reddit thread on this topic, if you&#8217;d like some background on what sharjeel is talking about, check section 1.2.1 in SICP, where it is made quite clear that the behavior of an algorithm as quite distinct from it&#8217;s description.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Recursion, Misunderstood by Saad</title>
		<link>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-509</link>
		<dc:creator>Saad</dc:creator>
		<pubDate>Sat, 25 Oct 2008 17:50:54 +0000</pubDate>
		<guid>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-509</guid>
		<description>Really Sharjeel,

before you make big statements like this in future, go and read Programming Languages. Also, Lisp is a TERRIBLE choice to demonstrate your point if you are aiming at a somewhat wider audience.</description>
		<content:encoded><![CDATA[<p>Really Sharjeel,</p>
<p>before you make big statements like this in future, go and read Programming Languages. Also, Lisp is a TERRIBLE choice to demonstrate your point if you are aiming at a somewhat wider audience.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Recursion, Misunderstood by bm</title>
		<link>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-507</link>
		<dc:creator>bm</dc:creator>
		<pubDate>Sat, 25 Oct 2008 15:18:24 +0000</pubDate>
		<guid>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-507</guid>
		<description>ben: iteration doesn't have to do with syntax. An iterative process is iterative, be the case that you use gotos, for loops or tail calls. Thus, in a language which does tail call optimization, the tail "recursive" version is actually iterative.</description>
		<content:encoded><![CDATA[<p>ben: iteration doesn&#8217;t have to do with syntax. An iterative process is iterative, be the case that you use gotos, for loops or tail calls. Thus, in a language which does tail call optimization, the tail &#8220;recursive&#8221; version is actually iterative.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Recursion, Misunderstood by Tony Morris</title>
		<link>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-506</link>
		<dc:creator>Tony Morris</dc:creator>
		<pubDate>Sat, 25 Oct 2008 14:11:55 +0000</pubDate>
		<guid>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-506</guid>
		<description>"but java doesn’t — JVM-based functional languages use various hacks to allow TCO."

Bzzt. You mean *Sun* Java implementation. The IBM implementation most certainly supports TCO.</description>
		<content:encoded><![CDATA[<p>&#8220;but java doesn’t — JVM-based functional languages use various hacks to allow TCO.&#8221;</p>
<p>Bzzt. You mean *Sun* Java implementation. The IBM implementation most certainly supports TCO.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Recursion, Misunderstood by y</title>
		<link>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-504</link>
		<dc:creator>y</dc:creator>
		<pubDate>Sat, 25 Oct 2008 13:13:27 +0000</pubDate>
		<guid>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-504</guid>
		<description>(define facti
   (lambda (n, c)
      (if (= n 0) c
         (facti (- n 1) (* c n))

This is recursive because it calls itsself.
R5RS has a definition of recursion you should use instead of inventing your own.</description>
		<content:encoded><![CDATA[<p>(define facti<br />
   (lambda (n, c)<br />
      (if (= n 0) c<br />
         (facti (- n 1) (* c n))</p>
<p>This is recursive because it calls itsself.<br />
R5RS has a definition of recursion you should use instead of inventing your own.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Recursion, Misunderstood by notyouravgjoel</title>
		<link>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-503</link>
		<dc:creator>notyouravgjoel</dc:creator>
		<pubDate>Sat, 25 Oct 2008 13:04:03 +0000</pubDate>
		<guid>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-503</guid>
		<description>Your iterative solutions are only truly iterative if the language supports tail recursion. Most (all?) functional languages support TCO, and so does gcc (supposedly); but java doesn't -- JVM-based functional languages use various hacks to allow TCO.

AFAIK, python does not support TCO, so if not, the python facti might still kill the stack.</description>
		<content:encoded><![CDATA[<p>Your iterative solutions are only truly iterative if the language supports tail recursion. Most (all?) functional languages support TCO, and so does gcc (supposedly); but java doesn&#8217;t &#8212; JVM-based functional languages use various hacks to allow TCO.</p>
<p>AFAIK, python does not support TCO, so if not, the python facti might still kill the stack.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Recursion, Misunderstood by ben</title>
		<link>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-502</link>
		<dc:creator>ben</dc:creator>
		<pubDate>Sat, 25 Oct 2008 12:58:44 +0000</pubDate>
		<guid>http://sharjeel.2scomplement.com/2008/10/25/recursion-misunderstood/#comment-502</guid>
		<description>Actually, both definitions are recursive. In fact, the one labeled as iterative is tail recursive, using an accumulator to avoid leaving work to do on the stack. An iterative implementation in Scheme might be

(define (facti n)
  (let ((total 1))
    (do ((i n))
	((&#60;= i 0))
      (set! total (* total i))
      (set! i (- i 1)))
    total))

Cheers.</description>
		<content:encoded><![CDATA[<p>Actually, both definitions are recursive. In fact, the one labeled as iterative is tail recursive, using an accumulator to avoid leaving work to do on the stack. An iterative implementation in Scheme might be</p>
<p>(define (facti n)<br />
  (let ((total 1))<br />
    (do ((i n))<br />
	((&lt;= i 0))<br />
      (set! total (* total i))<br />
      (set! i (- i 1)))<br />
    total))</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
