<?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: Perl 6 and the Josephus problem</title>
	<atom:link href="http://daniel.carrera.bz/2009/06/perl-6-and-the-josephus-problem/feed/" rel="self" type="application/rss+xml" />
	<link>http://daniel.carrera.bz/2009/06/perl-6-and-the-josephus-problem/</link>
	<description>No trees were killed in the production of this website.</description>
	<lastBuildDate>Tue, 13 Jul 2010 07:06:14 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Konstantin</title>
		<link>http://daniel.carrera.bz/2009/06/perl-6-and-the-josephus-problem/comment-page-1/#comment-441</link>
		<dc:creator>Konstantin</dc:creator>
		<pubDate>Thu, 07 Jan 2010 22:46:25 +0000</pubDate>
		<guid isPermaLink="false">http://daniel.carrera.bz/?p=1259#comment-441</guid>
		<description>BTW,  I copy-pasted your example, it fail with

 
Cannot assign to readonly variable.
in method Person::createChain (file , line )
called from Main (file ./test2.p6, line 0)


I think that this line

has ($.position, $.succ is rw);


does not define position as writable</description>
		<content:encoded><![CDATA[<p>BTW,  I copy-pasted your example, it fail with</p>
<p>Cannot assign to readonly variable.<br />
in method Person::createChain (file , line )<br />
called from Main (file ./test2.p6, line 0)</p>
<p>I think that this line</p>
<p>has ($.position, $.succ is rw);</p>
<p>does not define position as writable</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://daniel.carrera.bz/2009/06/perl-6-and-the-josephus-problem/comment-page-1/#comment-418</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Sat, 13 Jun 2009 15:53:20 +0000</pubDate>
		<guid isPermaLink="false">http://daniel.carrera.bz/?p=1259#comment-418</guid>
		<description>Perl 6 is now going to have a &quot;.rotate&quot; method. So you will be able to solve the Josephus problem with:

&lt;pre&gt;
my @p = 1..40;
@p.rotate(2).shift while @p &gt; 1;
say @p
&lt;/pre&gt;

... which is both cool, and much easier to read than the push+splice version. You can readily see how the algorithm works (rotate by 2, remove 1, repeat).</description>
		<content:encoded><![CDATA[<p>Perl 6 is now going to have a &#8220;.rotate&#8221; method. So you will be able to solve the Josephus problem with:</p>
<pre>
my @p = 1..40;
@p.rotate(2).shift while @p > 1;
say @p
</pre>
<p>&#8230; which is both cool, and much easier to read than the push+splice version. You can readily see how the algorithm works (rotate by 2, remove 1, repeat).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: programmingpraxis</title>
		<link>http://daniel.carrera.bz/2009/06/perl-6-and-the-josephus-problem/comment-page-1/#comment-416</link>
		<dc:creator>programmingpraxis</dc:creator>
		<pubDate>Sat, 13 Jun 2009 15:03:30 +0000</pubDate>
		<guid isPermaLink="false">http://daniel.carrera.bz/?p=1259#comment-416</guid>
		<description>I solved this problem in Scheme at my blog.  See http://programmingpraxis.wordpress.com/2009/02/19/flavius-josephus/.</description>
		<content:encoded><![CDATA[<p>I solved this problem in Scheme at my blog.  See <a href="http://programmingpraxis.wordpress.com/2009/02/19/flavius-josephus/." rel="nofollow">http://programmingpraxis.wordpress.com/2009/02/19/flavius-josephus/.</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://daniel.carrera.bz/2009/06/perl-6-and-the-josephus-problem/comment-page-1/#comment-415</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Sat, 13 Jun 2009 10:59:02 +0000</pubDate>
		<guid isPermaLink="false">http://daniel.carrera.bz/?p=1259#comment-415</guid>
		<description>Hi wtd,

Yes, indeed. And &quot;attr_accessor&quot; reads better too. And with that change, Ruby becomes the shortest by character count without becoming any less legible. I&#039;ll add a note to that effect on the post so everyone can see it.

Btw, I took the liberty of adding &lt;pre&gt; tags to your post so that the code sample reads better.</description>
		<content:encoded><![CDATA[<p>Hi wtd,</p>
<p>Yes, indeed. And &#8220;attr_accessor&#8221; reads better too. And with that change, Ruby becomes the shortest by character count without becoming any less legible. I&#8217;ll add a note to that effect on the post so everyone can see it.</p>
<p>Btw, I took the liberty of adding &lt;pre&gt; tags to your post so that the code sample reads better.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wtd</title>
		<link>http://daniel.carrera.bz/2009/06/perl-6-and-the-josephus-problem/comment-page-1/#comment-414</link>
		<dc:creator>wtd</dc:creator>
		<pubDate>Fri, 12 Jun 2009 16:45:10 +0000</pubDate>
		<guid isPermaLink="false">http://daniel.carrera.bz/?p=1259#comment-414</guid>
		<description>For what it&#039;s worth, there is a simple way to make the Ruby sample marginally shorter.

&lt;pre&gt;
class Person
	# Accessor and mutator methods
	attr_reader :position, :succ, :alive
	attr_writer :position, :succ, :alive

	# Initialize
	def initialize(pos)
		@position = pos
		@alive = true
	end
&lt;/pre&gt;

Could be rewritten using attr_accessor.

&lt;pre&gt;
class Person
	# Accessor and mutator methods
	attr_accessor :position, :succ, :alive

	# Initialize
	def initialize(pos)
		@position = pos
		@alive = true
	end
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>For what it&#8217;s worth, there is a simple way to make the Ruby sample marginally shorter.</p>
<pre>
class Person
	# Accessor and mutator methods
	attr_reader :position, :succ, :alive
	attr_writer :position, :succ, :alive

	# Initialize
	def initialize(pos)
		@position = pos
		@alive = true
	end
</pre>
<p>Could be rewritten using attr_accessor.</p>
<pre>
class Person
	# Accessor and mutator methods
	attr_accessor :position, :succ, :alive

	# Initialize
	def initialize(pos)
		@position = pos
		@alive = true
	end
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://daniel.carrera.bz/2009/06/perl-6-and-the-josephus-problem/comment-page-1/#comment-413</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Fri, 12 Jun 2009 16:26:58 +0000</pubDate>
		<guid isPermaLink="false">http://daniel.carrera.bz/?p=1259#comment-413</guid>
		<description>Larry W. has proposed a more compact solution:

&lt;pre&gt;
my @p = 1..40;
while @p &gt; 1 {
    @p.push(@p.splice(0,2));
    @p.shift
};
say @p
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Larry W. has proposed a more compact solution:</p>
<pre>
my @p = 1..40;
while @p > 1 {
    @p.push(@p.splice(0,2));
    @p.shift
};
say @p
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>
