Skip to content

Instantly share code, notes, and snippets.

cpanm (App::cpanminus) 1.7001 on perl 5.018002 built for i686-linux-gnu-thread-multi-64int
Work directory is /root/.cpanm/work/1467139323.24978
You have make /usr/bin/make
You have LWP 6.05
You have /bin/tar: tar (GNU tar) 1.27.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
@dogbert17
dogbert17 / gist:2b669457ea9e4e3203f050222350323d
Last active July 1, 2016 15:27
Attempt to document Baggy.ACCEPTS
=head2 method ACCEPTS
Defined as:
method ACCEPTS($other) returns Bool:D
Used in smart-matching if the right-hand side is a C<Baggy>.
If the right hand side is the type object, i.e. C<Baggy>, the method
returns C<True> if C<$other> L<does|/routine/does#class_Mu> C<Baggy>
@dogbert17
dogbert17 / gist:818b4229a000c9e19c25b3c782951b44
Created July 3, 2016 10:15
Attempt to document Baggy.invert
=head2 method invert
Defined as:
method invert(Baggy:D:) returns Seq:D
Returns all elements and their respective weights as a L<Seq|/type/Seq> of L<Pairs|/type/Pair>,
where the element itself is the value and the weight of that element is the key, i.e.
the opposite of method L<pairs|#method pairs>. Except for some esoteric cases C<invert> on a
Baggy type returns the same result as L<antipairs|#method_antipairs>.
@dogbert17
dogbert17 / gist:951106b1c4c66848d9bc491c4753d3e6
Created July 4, 2016 16:53
Attempt to document Version.Str and gist
=head2 method Str
method Str(Version:D:) returns Str:D
Returns a string representation of the invocant.
my $v1 = Version.new(v1.0.1+);
my $v2 = Version.new('1.0.1+');
say $v1.Str; # 1.0.1+
say $v2.Str; # 1.0.1+
@dogbert17
dogbert17 / gist:3f7c351762eefea9b97eb4746ffe4603
Last active July 7, 2016 15:43
Attempt to document Capture.keys
=head2 method keys
Defined as:
multi method keys(Capture:D:) returns Seq:D
Usage:
$capture.keys
@dogbert17
dogbert17 / gist:226e7adbd1be17f38f00986b2e8e1bc0
Created July 8, 2016 15:23
Attempt to document Capture.pairs
=head2 method pairs
Defined as:
multi method pairs(Capture:D:) returns Seq:D
Usage:
$capture.pairs
@dogbert17
dogbert17 / gist:bdba98c0c62a0ec6511914adcb632437
Created July 12, 2016 16:19
Attempt to document Block.has-phasers
=head2 method has-phasers
Defined as:
method has-phasers() returns Int:D
Returns C<1> if the block contains any L<phasers|/language/phasers> otherwise
it returns C<0>.
my $block = { ENTER { say "entering block"}; 42 };
@dogbert17
dogbert17 / gist:3224c4290a01b94a023e03175dfafabe
Last active July 13, 2016 15:56
Attempt to document Str.samemark
=head2 routine samemark
multi sub samemark(Str:D $string, Str:D $pattern) returns Str:D
method samemark(Str:D: Str:D $pattern) returns Str:D
Returns a copy of C<$string> with the mark/accent information for each
character changed such that it matches the mark/accent of the corresponding
character in C<$pattern>. If C<$string> is longer than C<$pattern>, the
remaining characters in C<$string> receive the same mark/accent as the last
character in C<$pattern>. This means that C<$pattern> must contain at least
# enable wrapping:
use soft;
# function to be wrapped:
sub square-root($x) { $x.sqrt }
&square-root.wrap(-> $num {
nextsame if $num >= 0;
1i * callwith(abs($num));
});
@dogbert17
dogbert17 / gist:dddb8b7d8db541ca5c1e9998146ff960
Created July 19, 2016 20:02
Attempt to document List.Capture
=head2 method Capture
Defined as:
method Capture() returns Capture:D
Usage:
LIST.Capture