This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following table summarizes the methods that Cool provides, and what type they coerce to: | |
... | |
chomp Str | |
chop Str | |
codes Str | |
Int Int | |
Num Num | |
Rat Rat | |
Real Real | |
UInt UInt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way? | |
# real 10m52.262s | |
# user 10m37.848s | |
# sys 0m1.068s | |
# This is Rakudo version 2016.03-76-gb3b24bf built on MoarVM version 2016.03-84-g4afd7b6 | |
use v6; | |
my $size = 5; | |
my @mat[$size; $size]; | |
init-array(0, $size - 1, $size * $size); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head2 routine samecase | |
Defined as: | |
sub samecase(Cool $string, Cool $pattern) | |
method samecase(Cool:D: Cool $pattern) | |
Usage: | |
samecase STRING, PATTERN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head2 method unpolar | |
Defined as: | |
method unpolar(Numeric(Cool)) | |
Usage: | |
unpolar NUMERIC, NUMERIC | |
NUMERIC.unpolar(NUMERIC) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head2 routine polymod | |
Defined as: | |
method polymod(Int:D: +@mods) | |
Usage: | |
INTEGER.polymod(LIST) # Is this correct ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head2 routine sum | |
Defined as: | |
multi sub sum($list) returns Numeric:D | |
multi method sum(List:D:) returns Numeric:D | |
Usage: | |
sum LIST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head2 method formatter | |
Defined as: | |
method formatter(Dateish:D:) | |
Usage: | |
Dateish.formatter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head1 Methods | |
=head2 method from-posix | |
method from-posix($posix, Bool $prefer-leap-second = False) | |
Converts the POSIX timestamp C<$posix> to an Instant. | |
If C<$prefer-leap-second> is C<True>, the return value will be | |
the first of the two possible seconds in the case of a leap second. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head2 method freeze | |
Defined as: | |
method freeze(Pair:D:) | |
Usage: | |
PAIR.freeze |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin pod | |
=TITLE class X::Promise::Vowed | |
=SUBTITLE Error due to directly trying to keep/break a vowed promise. | |
class X::Promise::Vowed is Exception { } | |
This exception is thrown when code tries to keep/break an already vowed | |
promise without going through the corresponding C<Vow> object. |
OlderNewer