Permalink
Browse files

Update titles, add use v6, fix links, add pod

  • Loading branch information...
1 parent 38cded4 commit 99e14ad690cc7ac2564c8a4d12ab53dec9ae5939 Salve J. Nilsen committed Apr 21, 2012
@@ -1,6 +1,8 @@
+use v6;
+
=begin pod
-=head1 Problem
+=head1 100 Doors
You have 100 doors in a row that are all initially closed. You make 100 passes
by the doors. The first time through, you visit every door and toggle the door
@@ -9,7 +11,7 @@ =head1 Problem
every 3rd door (door #3, #6, #9, ...), etc, until you only visit the 100th
door.
-=head1 Question
+=head1 Task
What state are the doors in after the last pass? Which are open,
which are closed?
@@ -28,7 +30,7 @@ =head1 More
=head1 Features used
-C<X**> - http://perlcabal.org/syn/S03.html#Cross_operators
+C<X**> - L<http://perlcabal.org/syn/S03.html#Cross_operators>
=end pod
@@ -1,19 +1,19 @@
+use v6;
+
=begin pod
-=head1 Description
+=head1 Copy a string
This task is about copying a string. Where it is relevant, distinguish
between copying the contents of a string versus making an additional
reference to an existing string.
=head2 More
-http://rosettacode.org/wiki/Copy_a_string#Perl_6
+L<http://rosettacode.org/wiki/Copy_a_string#Perl_6>
=end pod
-use v6;
-
# There is no special handling needed to copy a string.
{
my $original = 'Hello.';
@@ -8,14 +8,12 @@ =head1 Create a two-dimensional array at runtime
output that element. Finally destroy the array if not done by the language
itself.
-=head1 Rosettacode URL
+=head1 More
-http://rosettacode.org/wiki/Create_a_two-dimensional_array_at_runtime#Perl_6
+L<http://rosettacode.org/wiki/Create_a_two-dimensional_array_at_runtime#Perl_6>
=end pod
-=cut
-
my ($major,$minor) = prompt("Dimensions? ").comb(/\d+/);
@@ -1,6 +1,8 @@
+use v6;
+
=begin pod
-=head1 Description
+=head1 Hailstone sequence
The Hailstone sequence of numbers can be generated from a starting positive
integer, n by:
@@ -28,9 +30,8 @@ =head1 More
U<http://rosettacode.org/wiki/Hailstone_sequence#Perl_6>
-=end pod
-use v6;
+=end pod
sub hailstone($n) { $n, { $_ %% 2 ?? $_ div 2 !! $_ * 3 + 1 } ... 1 }
@@ -1,8 +1,19 @@
-# http://rosettacode.org/wiki/Last_Fridays#Perl_6
-#
-# Write a program or a script that returns the last Fridays of each month
-# of a given year. The year may be given through any simple input method
-# in your language (command line, std in, etc.).
+use v6;
+
+=begin pod
+
+=head1 Last fridays of the year
+
+Write a program or a script that returns the last Fridays of each month
+of a given year. The year may be given through any simple input method
+in your language (command line, std in, etc.).
+
+=head1 More
+
+L<http://rosettacode.org/wiki/Last_Fridays#Perl_6>
+
+=end pod
+
sub MAIN (Int $year = Date.today.year) {
my @fri;
@@ -12,7 +23,15 @@ (Int $year = Date.today.year)
.say for @fri[1..12];
}
-# The MAIN sub: http://perlcabal.org/syn/S06.html#Declaring_a_MAIN_subroutine
-# Date objects: http://perlcabal.org/syn/S32/Temporal.html#Date
-#
-# vim: expandtab shiftwidth=4 ft=perl6:
+
+=begin pod
+
+=head1 Features used
+
+The MAIN sub - L<http://perlcabal.org/syn/S06.html#Declaring_a_MAIN_subroutine>
+
+Date objects - L<http://perlcabal.org/syn/S32/Temporal.html#Date>
+
+=end pod
+
+# vim: expandtab shiftwidth=2 ft=perl6:
@@ -1,18 +1,29 @@
-# The prime decomposition of a number is defined as a list of prime numbers
-# which when all multiplied together, are equal to that number.
-#
-# Example: 12 = 2 × 2 × 3, so its prime decomposition is {2, 2, 3}
-#
-# Write a function which returns an array or collection which contains the
-# prime decomposition of a given number, n, greater than 1. If your language
-# does not have an isPrime-like function available, you may assume that you
-# have a function which determines whether a number is prime (note its name
-# before your code).
-#
-# http://rosettacode.org/wiki/Prime_decomposition#Perl_6
-
use v6;
+=begin pod
+
+=head1 Prime decomposition
+
+The prime decomposition of a number is defined as a list of prime numbers
+which when all multiplied together, are equal to that number.
+
+Example: 12 = 2 × 2 × 3, so its prime decomposition is {2, 2, 3}
+
+=head1 Task
+
+Write a function which returns an array or collection which contains the
+prime decomposition of a given number, n, greater than 1. If your language
+does not have an isPrime-like function available, you may assume that you
+have a function which determines whether a number is prime (note its name
+before your code).
+
+=head1 More
+
+L<http://rosettacode.org/wiki/Prime_decomposition#Perl_6>
+
+=end pod
+
+
constant @primes = 2, 3, 5, -> $n is copy {
repeat { $n += 2 } until $n %% none @primes ... { $_ * $_ >= $n }
$n;

0 comments on commit 99e14ad

Please sign in to comment.