From 02a44a79315ee0c066513adde074f02fc9596431 Mon Sep 17 00:00:00 2001 From: Simon Proctor Date: Mon, 17 Jun 2019 14:15:03 +0100 Subject: Read the spec Simon --- challenge-013/simon-proctor/perl6/ch-1.p6 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/challenge-013/simon-proctor/perl6/ch-1.p6 b/challenge-013/simon-proctor/perl6/ch-1.p6 index 4ae432f3a2..32fd36f940 100644 --- a/challenge-013/simon-proctor/perl6/ch-1.p6 +++ b/challenge-013/simon-proctor/perl6/ch-1.p6 @@ -8,5 +8,9 @@ sub date-format( $date ) { sprintf "%04d/%02d/%02d", .year, .month, .day given $ sub MAIN ( Int() $year #= Year to list Fridays for. ) { - say( date-format( $_ ) ) for (Date.new( :$year, :1month, :1day, formatter => &date-format )...Date.new( :$year, :12month, :31day, formatter => &date-format )).grep( *.day-of-week() == 5); + say( date-format( $_ ) ) for (Date.new( :$year, :1month, :1day, formatter => &date-format )...Date.new( :$year, :12month, :31day, formatter => &date-format )) + .grep( *.day-of-week() == 5) + .sort( { $^b <=> $^a } ) + .grep( { state $m = 13; if ( $_.month < $m ) { $m = $_.month;True } else { False } }) + .sort( * <=> * ); } \ No newline at end of file -- cgit From dd179ae22ed7bfba6fbadbfad7f3f8cdb80b29e5 Mon Sep 17 00:00:00 2001 From: Simon Proctor Date: Mon, 17 Jun 2019 14:16:10 +0100 Subject: Remove erroneous date format --- challenge-013/simon-proctor/perl6/ch-1.p6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge-013/simon-proctor/perl6/ch-1.p6 b/challenge-013/simon-proctor/perl6/ch-1.p6 index 32fd36f940..2afdf0dbaf 100644 --- a/challenge-013/simon-proctor/perl6/ch-1.p6 +++ b/challenge-013/simon-proctor/perl6/ch-1.p6 @@ -8,7 +8,7 @@ sub date-format( $date ) { sprintf "%04d/%02d/%02d", .year, .month, .day given $ sub MAIN ( Int() $year #= Year to list Fridays for. ) { - say( date-format( $_ ) ) for (Date.new( :$year, :1month, :1day, formatter => &date-format )...Date.new( :$year, :12month, :31day, formatter => &date-format )) + say( date-format( $_ ) ) for (Date.new( :$year, :1month, :1day )...Date.new( :$year, :12month, :31day )) .grep( *.day-of-week() == 5) .sort( { $^b <=> $^a } ) .grep( { state $m = 13; if ( $_.month < $m ) { $m = $_.month;True } else { False } }) -- cgit