<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments for Programming Praxis</title>
	<atom:link href="http://programmingpraxis.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://programmingpraxis.com</link>
	<description>A collection of etudes, updated weekly, for the education and enjoyment of the savvy programmer</description>
	<lastBuildDate>Mon, 28 May 2012 03:30:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>Comment on Formatted Numeric Output by David</title>
		<link>http://programmingpraxis.com/2012/05/18/formatted-numeric-output/#comment-4873</link>
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Mon, 28 May 2012 03:30:45 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=6039#comment-4873</guid>
		<description><![CDATA[I thought it would be fun to implement the Dartmouth BASIC printing format.  This was back in the days where formatting didn&#039;t seem all the necessary as the computer printed how users intuitively expected things to go.  In FORTH since that language (a) has a standard word to pick apart a floating point number and (b) default printing is rather unfriendly in that language.

[sourcecode language=&quot;text&quot;]
{ ---------------------------------------------------------------------------
Rules for printing Dartmouth BASIC numbers  (except allowing more than 6
digits of precision, given the modern era of 64 bit FP.)

Let P = desired output precision:

1. If a number is an integer, the decimal point is not printed.  If the
   integer contains more than P digits, display in scientific notation with
   P significant digits.

2. For any decimal number, no more than P significant digits are printed.

3. For a number less than 0.1, the E notation is used unless the entire
   significant part of the number can be printed as a P decimal number.
   Thus, 0.01234578 means the number is exactly 0.012345678, while
   1.2345678E-2 means that the number has been rounded to 0.012345678

4. Trailing zeros after the decimal point are not printed.
 --------------------------------------------------------------------------- }

requires fpmath

create fp-repr  20 chars allot
create zero-str ,z&quot; 00000000000000000&quot; \ used to compare zero strings

: fp-integer?  ( exp -- )
    dup precision &gt;=          \ exponent &gt; precision =&gt; integer
    swap precision over -     \ length to compare
    swap fp-repr + swap       \ address to compare
    zero-str over compare 0=  \ compare to all zeros
    or ;

: (adjust)   ( addr count -- addr count&#039; )
    over + 1-   \ addr end-addr
    BEGIN  dup c@ [char] 0 = WHILE
        1-
    REPEAT  over - 1+ ;

: .sci  ( exp -- )
    fp-repr c@ emit
    [char] . emit
    fp-repr 1+ precision 1- (adjust) type
    [char] E emit
    dup 0&gt; IF  [char] + emit  THEN
    . ;

: .fp-integer ( exp -- )
    dup precision &lt;= IF
        fp-repr swap type space
    ELSE
        1- .sci
    THEN ;

: .fp-small  ( exp -- )
    fp-repr precision + 1- c@  [char] 0 = IF
        .&quot; 0.&quot;
        negate 0 DO  [char] 0 emit  LOOP
        fp-repr precision (adjust) type
    ELSE
        1- .sci
    THEN ;

: .fp   ( exp -- )
    dup IF
        dup fp-repr swap type
    ELSE
        [char] 0 emit
    THEN
    [char] . emit
    fp-repr over +  swap precision swap -  (adjust) type space ;

: fp.   ( fp -- )
    fp-repr precision represent
    invert IF abort&quot; Invalid FP value on stack.&quot; THEN
    ( sign ) IF  [char] - emit  THEN

    fp-repr c@ [char] 0 = IF   \ zero special case
        drop .&quot; 0&quot; exit
    THEN
    dup fp-integer? IF
        .fp-integer exit
    THEN
    dup 0&lt;    \ &lt;= 10^-1
        IF .fp-small exit
    THEN
    ( ELSE ) .fp ;
[/sourcecode]

Some tests:

[sourcecode language=&quot;text&quot;]
0e fp. 0 ok
2e fsqrt fp. 1.41421356237  ok
944,221,771,433,788 d&gt;f fp. 9.44221771434E+14  ok
0.00875e fp. 0.00875 ok
0.00877777777777777e fp. 8.77777777778E-3  ok
-25.75e fp. -25.75  ok
255e fp. 255  ok
49e fsqrt fp. 7  ok
0.530000e fp. 0.53  ok
6 set-precision  ok
676,211,477,636,211 d&gt;f f. 676211000000000.  ok
676,211,477,636,211 d&gt;f fp. 6.76211E+14  ok
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>I thought it would be fun to implement the Dartmouth BASIC printing format.  This was back in the days where formatting didn&#8217;t seem all the necessary as the computer printed how users intuitively expected things to go.  In FORTH since that language (a) has a standard word to pick apart a floating point number and (b) default printing is rather unfriendly in that language.</p>
<pre class="brush: plain;">
{ ---------------------------------------------------------------------------
Rules for printing Dartmouth BASIC numbers  (except allowing more than 6
digits of precision, given the modern era of 64 bit FP.)

Let P = desired output precision:

1. If a number is an integer, the decimal point is not printed.  If the
   integer contains more than P digits, display in scientific notation with
   P significant digits.

2. For any decimal number, no more than P significant digits are printed.

3. For a number less than 0.1, the E notation is used unless the entire
   significant part of the number can be printed as a P decimal number.
   Thus, 0.01234578 means the number is exactly 0.012345678, while
   1.2345678E-2 means that the number has been rounded to 0.012345678

4. Trailing zeros after the decimal point are not printed.
 --------------------------------------------------------------------------- }

requires fpmath

create fp-repr  20 chars allot
create zero-str ,z&quot; 00000000000000000&quot; \ used to compare zero strings

: fp-integer?  ( exp -- )
    dup precision &gt;=          \ exponent &gt; precision =&gt; integer
    swap precision over -     \ length to compare
    swap fp-repr + swap       \ address to compare
    zero-str over compare 0=  \ compare to all zeros
    or ;

: (adjust)   ( addr count -- addr count' )
    over + 1-   \ addr end-addr
    BEGIN  dup c@ [char] 0 = WHILE
        1-
    REPEAT  over - 1+ ;

: .sci  ( exp -- )
    fp-repr c@ emit
    [char] . emit
    fp-repr 1+ precision 1- (adjust) type
    [char] E emit
    dup 0&gt; IF  [char] + emit  THEN
    . ;

: .fp-integer ( exp -- )
    dup precision &lt;= IF
        fp-repr swap type space
    ELSE
        1- .sci
    THEN ;

: .fp-small  ( exp -- )
    fp-repr precision + 1- c@  [char] 0 = IF
        .&quot; 0.&quot;
        negate 0 DO  [char] 0 emit  LOOP
        fp-repr precision (adjust) type
    ELSE
        1- .sci
    THEN ;

: .fp   ( exp -- )
    dup IF
        dup fp-repr swap type
    ELSE
        [char] 0 emit
    THEN
    [char] . emit
    fp-repr over +  swap precision swap -  (adjust) type space ;

: fp.   ( fp -- )
    fp-repr precision represent
    invert IF abort&quot; Invalid FP value on stack.&quot; THEN
    ( sign ) IF  [char] - emit  THEN

    fp-repr c@ [char] 0 = IF   \ zero special case
        drop .&quot; 0&quot; exit
    THEN
    dup fp-integer? IF
        .fp-integer exit
    THEN
    dup 0&lt;    \ &lt;= 10^-1
        IF .fp-small exit
    THEN
    ( ELSE ) .fp ;
</pre>
<p>Some tests:</p>
<pre class="brush: plain;">
0e fp. 0 ok
2e fsqrt fp. 1.41421356237  ok
944,221,771,433,788 d&gt;f fp. 9.44221771434E+14  ok
0.00875e fp. 0.00875 ok
0.00877777777777777e fp. 8.77777777778E-3  ok
-25.75e fp. -25.75  ok
255e fp. 255  ok
49e fsqrt fp. 7  ok
0.530000e fp. 0.53  ok
6 set-precision  ok
676,211,477,636,211 d&gt;f f. 676211000000000.  ok
676,211,477,636,211 d&gt;f fp. 6.76211E+14  ok
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Ackermann&#8217;s Function by cdelahousse</title>
		<link>http://programmingpraxis.com/2012/05/25/ackermanns-function/#comment-4868</link>
		<dc:creator><![CDATA[cdelahousse]]></dc:creator>
		<pubDate>Sat, 26 May 2012 23:17:38 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=6051#comment-4868</guid>
		<description><![CDATA[[sourcecode lang=&quot;javascript&quot;]
function A(m,n) {
	return (m == 0) ?
			n + 1 :
		( m &gt; 0 &amp;&amp; n ==0 ) ?
			A(m - 1,1) :
		( m &gt; 0 &amp;&amp; n &gt; 0) ?
			A(m - 1, A(m,n-1)) :
			undefined;
}
[/sourcecode]

http://jsfiddle.net/vcKdF/3248/]]></description>
		<content:encoded><![CDATA[<pre class="brush: jscript;">
function A(m,n) {
	return (m == 0) ?
			n + 1 :
		( m &gt; 0 &amp;&amp; n ==0 ) ?
			A(m - 1,1) :
		( m &gt; 0 &amp;&amp; n &gt; 0) ?
			A(m - 1, A(m,n-1)) :
			undefined;
}
</pre>
<p><a href="http://jsfiddle.net/vcKdF/3248/" rel="nofollow">http://jsfiddle.net/vcKdF/3248/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Ackermann&#8217;s Function by iapain</title>
		<link>http://programmingpraxis.com/2012/05/25/ackermanns-function/#comment-4867</link>
		<dc:creator><![CDATA[iapain]]></dc:creator>
		<pubDate>Sat, 26 May 2012 20:47:25 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=6051#comment-4867</guid>
		<description><![CDATA[Ha! Ackermann&#039;s function. At least this can computer A(4,2) in python

&lt;code&gt;
def ackermann(m, n):
    while m &gt;= 4:
        if n == 0:
            n = 1
        else:
            n = ackermann(m, n - 1)
        m = m - 1
    if m == 3:
        return (1 &lt;&lt; n + 3) - 3
    elif m == 2:
        return (n &lt;&lt; 1) + 3
    elif m == 1:
        return n + 2
    else:
        return n + 1

print ackermann(4,2)
&lt;/code&gt;

http://codepad.org/QdneSl1Q]]></description>
		<content:encoded><![CDATA[<p>Ha! Ackermann&#8217;s function. At least this can computer A(4,2) in python</p>
<p><code><br />
def ackermann(m, n):<br />
    while m &gt;= 4:<br />
        if n == 0:<br />
            n = 1<br />
        else:<br />
            n = ackermann(m, n - 1)<br />
        m = m - 1<br />
    if m == 3:<br />
        return (1 &lt;&lt; n + 3) - 3<br />
    elif m == 2:<br />
        return (n &lt;&lt; 1) + 3<br />
    elif m == 1:<br />
        return n + 2<br />
    else:<br />
        return n + 1</p>
<p>print ackermann(4,2)<br />
</code></p>
<p><a href="http://codepad.org/QdneSl1Q" rel="nofollow">http://codepad.org/QdneSl1Q</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Ackermann&#8217;s Function by programmingpraxis</title>
		<link>http://programmingpraxis.com/2012/05/25/ackermanns-function/#comment-4866</link>
		<dc:creator><![CDATA[programmingpraxis]]></dc:creator>
		<pubDate>Sat, 26 May 2012 13:13:59 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=6051#comment-4866</guid>
		<description><![CDATA[Toecutter: If your language doesn&#039;t provide a sufficient stack, you must create your own stack; that&#039;s the point of the exercise. A(4,1)=65533 should be within range of your function.]]></description>
		<content:encoded><![CDATA[<p>Toecutter: If your language doesn&#8217;t provide a sufficient stack, you must create your own stack; that&#8217;s the point of the exercise. A(4,1)=65533 should be within range of your function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Ackermann&#8217;s Function by toecutter</title>
		<link>http://programmingpraxis.com/2012/05/25/ackermanns-function/#comment-4865</link>
		<dc:creator><![CDATA[toecutter]]></dc:creator>
		<pubDate>Sat, 26 May 2012 01:31:31 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=6051#comment-4865</guid>
		<description><![CDATA[Feel free to laugh at me. I tried to use visual C# for this.  Stack overflow or there is some arbitrary stack limit where visual C# in its infinite wisdom decided I didn&#039;t know what I was doing.  Fun times]]></description>
		<content:encoded><![CDATA[<p>Feel free to laugh at me. I tried to use visual C# for this.  Stack overflow or there is some arbitrary stack limit where visual C# in its infinite wisdom decided I didn&#8217;t know what I was doing.  Fun times</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Ackermann&#8217;s Function by slabounty</title>
		<link>http://programmingpraxis.com/2012/05/25/ackermanns-function/#comment-4864</link>
		<dc:creator><![CDATA[slabounty]]></dc:creator>
		<pubDate>Fri, 25 May 2012 22:19:20 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=6051#comment-4864</guid>
		<description><![CDATA[[sourcecode lang=&quot;ruby&quot;]
def a(m, n)
  if m == 0
    n+1
  elsif m &gt; 0 &amp;&amp; n == 0
    a(m-1, 1)
  else
    a(m-1, a(m, n-1))
  end
end

puts &quot;ackerman 3, 4 = #{a(3, 4)}&quot;
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<pre class="brush: ruby;">
def a(m, n)
  if m == 0
    n+1
  elsif m &gt; 0 &amp;&amp; n == 0
    a(m-1, 1)
  else
    a(m-1, a(m, n-1))
  end
end

puts &quot;ackerman 3, 4 = #{a(3, 4)}&quot;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Ackermann&#8217;s Function by In the News: 2012-05-25 &#124; Klaus&#039; Korner</title>
		<link>http://programmingpraxis.com/2012/05/25/ackermanns-function/#comment-4863</link>
		<dc:creator><![CDATA[In the News: 2012-05-25 &#124; Klaus&#039; Korner]]></dc:creator>
		<pubDate>Fri, 25 May 2012 13:28:23 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=6051#comment-4863</guid>
		<description><![CDATA[[...] Programming News: Ackermann’s Function    In the 1920s, Wilhelm Ackermann demonstrated a computable function that was not primitive-recursive, settling an important argument in the run-up to the theory of computation.     Read full story =&gt; Programming Praxis [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Programming News: Ackermann’s Function    In the 1920s, Wilhelm Ackermann demonstrated a computable function that was not primitive-recursive, settling an important argument in the run-up to the theory of computation.     Read full story =&gt; Programming Praxis [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Ackermann&#8217;s Function by Graham</title>
		<link>http://programmingpraxis.com/2012/05/25/ackermanns-function/#comment-4862</link>
		<dc:creator><![CDATA[Graham]]></dc:creator>
		<pubDate>Fri, 25 May 2012 10:15:51 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=6051#comment-4862</guid>
		<description><![CDATA[Given how heavily recursive this function is, I went with Haskell instead of Python:
[sourcecode lang=&quot;css&quot;]
a :: Integer -&gt; Integer -&gt; Integer
a 0 n = n + 1
a m 0 = a (m - 1) 1
a m n = a (m - 1) $ a m (n - 1)

main :: IO ()
main = print $ a 3 4
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>Given how heavily recursive this function is, I went with Haskell instead of Python:</p>
<pre class="brush: css;">
a :: Integer -&gt; Integer -&gt; Integer
a 0 n = n + 1
a m 0 = a (m - 1) 1
a m n = a (m - 1) $ a m (n - 1)

main :: IO ()
main = print $ a 3 4
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Pairing Heaps by Generating integers in ascending order using a set of prime numbers &#124; PHP Developer Resource</title>
		<link>http://programmingpraxis.com/2009/08/14/pairing-heaps/#comment-4861</link>
		<dc:creator><![CDATA[Generating integers in ascending order using a set of prime numbers &#124; PHP Developer Resource]]></dc:creator>
		<pubDate>Wed, 23 May 2012 13:56:16 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=1175#comment-4861</guid>
		<description><![CDATA[[...] a program to implement the algorithm described above, using the Scheme programming language. First, here is a library implementation of priority queues using the pairing heap [...]]]></description>
		<content:encoded><![CDATA[<p>[...] a program to implement the algorithm described above, using the Scheme programming language. First, here is a library implementation of priority queues using the pairing heap [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Hamming Codes by phil</title>
		<link>http://programmingpraxis.com/2012/05/22/hamming-codes/#comment-4860</link>
		<dc:creator><![CDATA[phil]]></dc:creator>
		<pubDate>Tue, 22 May 2012 19:07:38 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=6047#comment-4860</guid>
		<description><![CDATA[i found this sites algorithm easier to understand, http://users.cs.fiu.edu/~downeyt/cop3402/hamming.html
so, that&#039;s what  tried to implement.
please make note of the comment at top.
http://pastebin.com/DKvQiJZg]]></description>
		<content:encoded><![CDATA[<p>i found this sites algorithm easier to understand, <a href="http://users.cs.fiu.edu/~downeyt/cop3402/hamming.html" rel="nofollow">http://users.cs.fiu.edu/~downeyt/cop3402/hamming.html</a><br />
so, that&#8217;s what  tried to implement.<br />
please make note of the comment at top.<br />
<a href="http://pastebin.com/DKvQiJZg" rel="nofollow">http://pastebin.com/DKvQiJZg</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

