Sha256: 3867500c305e667216fe2b0bc6bdcb139837110028efa68fd1b2eeccccd348a0

Contents?: true

Size: 1.11 KB

Versions: 83

Compression:

Stored size: 1.11 KB

Contents

exercise: Meetup
version: 2
plan: 95
tests: |-
  is meetup-date(.<description>), Date.new(|.<year month dayofmonth>), .<description> for @($c-data<cases>);

unit: module
example: |-
  sub meetup-date (Str:D $desc --> Date:D) is export {
    my (Date $date, Str $day-of-week);
    given $desc.words {
      $date = Date.new: year => .[*-1];

      given .[*-2] {
        $date.=later: months => %(<
          January February March
          April May June
          July August September
          October November December
        >.antipairs){$_}
      }

      $day-of-week = S/day// given .[1].lc;
      $date.=later: days => (given .[0] {
        when 'first'   { 0}
        when 'second'  { 7}
        when 'third'   {14}
        when 'fourth'  {21}
        when /teenth$/ {$day-of-week = S/teenth// given $_; 12}
        when 'last'    {$date.=later(:1month); -7}
      });
    }

    $date.=succ until $date.day-of-week == (given <
      mon tues
      wednes thurs
      fri satur sun
    > {
      %(.values Z=> .keys »+» 1){$day-of-week}
    });

    return $date;
  }

stub: |-
  sub meetup-date ($desc) is export {
  }

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.138 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.137 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.136 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.135 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.134 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.133 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.132 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.131 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.130 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.129 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.128 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.127 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.126 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.125 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.124 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.123 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.122 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.121 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml
trackler-2.2.1.120 tracks/perl6/exercises/meetup/.meta/exercise-data.yaml