r31573 -[Str] limits should default to Inf rather than * since that is (supposedly) compatible with Int
Author: lwall Date: 2010-07-08 03:37:15 +0200 (Thu, 08 Jul 2010) New Revision: 31573 Modified: docs/Perl6/Spec/S32-setting-library/Str.pod Log: [Str] limits should default to Inf rather than * since that is (supposedly) compatible with Int Modified: docs/Perl6/Spec/S32-setting-library/Str.pod === --- docs/Perl6/Spec/S32-setting-library/Str.pod 2010-07-07 23:45:31 UTC (rev 31572) +++ docs/Perl6/Spec/S32-setting-library/Str.pod 2010-07-08 01:37:15 UTC (rev 31573) @@ -339,10 +339,10 @@ =item split X - our List multi split ( Str $delimiter, Str $input, Int $limit = * ) - our List multi split ( Regex $delimiter, Str $input, Int $limit = * ) - our List multi method split ( Str $input: Str $delimiter, Int $limit = * ) - our List multi method split ( Str $input: Regex $delimiter, Int $limit = *, Bool :$all = False) + our List multi split ( Str $delimiter, Str $input, Int $limit = Inf ) + our List multi split ( Regex $delimiter, Str $input, Int $limit = Inf ) + our List multi method split ( Str $input: Str $delimiter, Int $limit = Inf ) + our List multi method split ( Str $input: Regex $delimiter, Int $limit = Inf, Bool :$all = False) Splits a string up into pieces based on delimiters found in the string. @@ -371,8 +371,8 @@ =item comb - our List multi comb ( Regex $matcher, Str $input, Int $limit = * ) - our List multi method comb ( Str $input: Regex $matcher = /./, Int $limit = * ) + our List multi comb ( Regex $matcher, Str $input, Int $limit = Inf ) + our List multi method comb ( Str $input: Regex $matcher = /./, Int $limit = Inf ) The C function looks through a string for the interesting bits, ignoring the parts that don't match. In other words, it's a version @@ -404,14 +404,14 @@ =item lines - our List multi method lines ( Str $input: Int $limit = * ) is export + our List multi method lines ( Str $input: Int $limit = Inf ) is export Returns a list of lines, i.e. the same as a call to C<$input.comb( / \N*\n | \N+$ /, $limit )> would. =item words - our List multi method words ( Str $input: Int $limit = * ) is export + our List multi method words ( Str $input: Int $limit = Inf ) is export Returns a list of non-whitespace bits, i.e. the same as a call to C<$input.comb( / \S+ /, $limit )> would.
r31571 -[S32] Dropped mention of quarters from Temporal.pod. I don't think quarter-numbering belongs in the core, since (as far as I know) there is no precise standard way of dividing calendar years i
Author: Kodi Date: 2010-07-08 01:42:53 +0200 (Thu, 08 Jul 2010) New Revision: 31571 Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod t/spec/S32-temporal/DateTime.t Log: [S32] Dropped mention of quarters from Temporal.pod. I don't think quarter-numbering belongs in the core, since (as far as I know) there is no precise standard way of dividing calendar years into four. Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod === --- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-07 22:19:08 UTC (rev 31570) +++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-07 23:42:53 UTC (rev 31571) @@ -128,9 +128,6 @@ month, the day itself included. For example, June 9, 2003 is the second Monday of the month, and so this method returns 2 for that day. -The C method returns the quarter of the year, a value between 1 -and 4. The C method returns the day of the quarter. - The C method returns the day of the year, a value between 1 and 366. Modified: t/spec/S32-temporal/DateTime.t === --- t/spec/S32-temporal/DateTime.t 2010-07-07 22:19:08 UTC (rev 31570) +++ t/spec/S32-temporal/DateTime.t 2010-07-07 23:42:53 UTC (rev 31571) @@ -1,8 +1,10 @@ use v6; use Test; +use Temporal; use Date; # XXX + plan *; - +#`⁅ my ( DateTime $g1, DateTime $g2, Num $t, Int $d ); $g1 = DateTime.from-epoch(0); @@ -132,17 +134,17 @@ is $date.month, 6, 'Date month'; # test 23 is $date.day, 4, 'Date day'; # test 24 -# --- - +# +#`⁆ sub dt { DateTime.new(year => 1984, |%_); } sub ds (Str $s) { DateTime.new($s) } sub ymd ($y, $m, $d) { DateTime.new(year => $y, month => $m, day => $d); } my $now = DateTime.now; - -# --- +#`⁅ +# # Input validation -# --- +# # L'/outside of the ranges specified> @@ -197,9 +199,9 @@ lives_ok { $now.set(second => 61.5) }, 'DateTime accepts second 61.5 (.set)'; dies_ok { $now.set(second => 62) }, 'DateTime rejects second 62 (.set)'; -# --- +# # L'> -# --- +# is dt(second => 22).whole-second, 22, 'DateTime.whole-second (22)'; is dt(second => 22.1).whole-second, 22, 'DateTime.whole-second (22.1)'; @@ -209,9 +211,9 @@ is dt(second => 60).whole-second, 60, 'DateTime.whole-second (60)'; is dt(second => 60.5).whole-second, 60, 'DateTime.whole-second (60.5)'; -# --- +# # L'> -# --- +# is ymd(1977, 8, 20).week.join(' '), '1977 33', 'DateTime.week (1977-8-20)'; is ymd(1977, 8, 20).week-year, 1977, 'DateTime.week (1977-8-20)'; @@ -238,14 +240,121 @@ is ymd(2010, 01, 03).week-year, 2009, 'DateTime.week-year (2010-01-03)'; is ymd(2010, 01, 03).week-number, 53, 'DateTime.week-number (2010-01-03)'; -# --- +# # L -# --- +# is $now.date, $now.ymd, 'DateTime.ymd can be spelled as DateTime.date'; is $now.time, $now.hms, 'DateTime.hms can be spelled as DateTime.time'; +# +# L method'> +# + +{ +my $moon-landing = dt# Although the seconds part is fictional. + year => 1969, month => 6, day => 20, + hour => 8, minute => 17, second => 32.4; + +my $dt = $moon-landing.clone; $dt.truncate(to => 'second'); +is $dt.second, 32, 'DateTime.truncate(to => "second")'; +$dt = $moon-landing.clone; $dt.truncate(to => 'minute'); +is $dt.iso8601, '1969-06-20T08:17:00+', 'DateTime.truncate(to => "minute")'; +$dt = $moon-landing.clone; $dt.truncate(to => 'hour'); +is $dt.iso8601, '1969-06-20T08:00:00+', 'DateTime.truncate(to => "hour")'; +$dt = $moon-landing.clone; $dt.truncate(to => 'day'); +is $dt.iso8601, '1969-06-20T00:00:00+', 'DateTime.truncate(to => "day")'; +$dt = $moon-l
r31570 -[S32/Str] saved a few words and lines with "is export"
Author: masak Date: 2010-07-08 00:19:08 +0200 (Thu, 08 Jul 2010) New Revision: 31570 Modified: docs/Perl6/Spec/S32-setting-library/Str.pod Log: [S32/Str] saved a few words and lines with "is export" Modified: docs/Perl6/Spec/S32-setting-library/Str.pod === --- docs/Perl6/Spec/S32-setting-library/Str.pod 2010-07-07 22:13:41 UTC (rev 31569) +++ docs/Perl6/Spec/S32-setting-library/Str.pod 2010-07-07 22:19:08 UTC (rev 31570) @@ -404,16 +404,14 @@ =item lines - our List multi lines ( Str $input, Int $limit = * ) - our List multi method lines ( Str $input: Int $limit = * ) + our List multi method lines ( Str $input: Int $limit = * ) is export Returns a list of lines, i.e. the same as a call to C<$input.comb( / \N*\n | \N+$ /, $limit )> would. =item words - our List multi words ( Str $input, Int $limit = * ) - our List multi method words ( Str $input: Int $limit = * ) + our List multi method words ( Str $input: Int $limit = * ) is export Returns a list of non-whitespace bits, i.e. the same as a call to C<$input.comb( / \S+ /, $limit )> would.
r31569 -[IO,Str] regularize .lines to be more like .words when fed a string
Author: lwall Date: 2010-07-08 00:13:41 +0200 (Thu, 08 Jul 2010) New Revision: 31569 Modified: docs/Perl6/Spec/S32-setting-library/IO.pod docs/Perl6/Spec/S32-setting-library/Str.pod Log: [IO,Str] regularize .lines to be more like .words when fed a string .lines will no longer interpret a string as a filename Modified: docs/Perl6/Spec/S32-setting-library/IO.pod === --- docs/Perl6/Spec/S32-setting-library/IO.pod 2010-07-07 21:04:26 UTC (rev 31568) +++ docs/Perl6/Spec/S32-setting-library/IO.pod 2010-07-07 22:13:41 UTC (rev 31569) @@ -892,14 +892,7 @@ --> List ) -multi lines (Str $filename, -Any $limit = *, -Bool :$bin = False, -Str :$enc = "Unicode", -Any :$nl = "\n", -Bool :$chomp = True, ---> List -) +# See also Str.lines and lines(Str) Returns some or all the lines of a file or entries in a directory as a C regardless of context. Modified: docs/Perl6/Spec/S32-setting-library/Str.pod === --- docs/Perl6/Spec/S32-setting-library/Str.pod 2010-07-07 21:04:26 UTC (rev 31568) +++ docs/Perl6/Spec/S32-setting-library/Str.pod 2010-07-07 22:13:41 UTC (rev 31569) @@ -402,6 +402,14 @@ function is combing a lazy structure, the return values may also be lazy. (Strings are not lazy, however.) +=item lines + + our List multi lines ( Str $input, Int $limit = * ) + our List multi method lines ( Str $input: Int $limit = * ) + +Returns a list of lines, i.e. the same as a call to +C<$input.comb( / \N*\n | \N+$ /, $limit )> would. + =item words our List multi words ( Str $input, Int $limit = * )