Skip to content

Instantly share code, notes, and snippets.

View Restricted.rakumod
use uniname-words;
constant $stdin-text = qq:to/EOH/;
I ♥ Raku!
1 22 333 4444 55555 6565656
3.14159265358979323846264338327950288419716939937510582097494459
A line with the number 42.
We may need some "quotes".
A backslash \\
would be nice too.
View predicate-batch-iterator.raku
use v6.*;
class PredicateBatchIterator does Iterator {
class UnPrimed {}
has Iterator $.input is required;
has &.predicate is required;
has $.stashed is rw = UnPrimed;
submethod TWEAK { }
View stealth-iterables.raku
my @types =
Q{AST},
Q{Allomorph},
Q{Any},
Q{Array},
Q{Associative},
Q{Attribute},
Q{Awaitable},
Q{Awaiter},
Q{Backtrace},
View fake-trust.raku
use v6.d;
class A {
has $!a = 'private';
method !a { $!a }
}
multi sub trait_mod:<is>(Mu:U \obj, :$spying!) {
A.^add_trustee(obj);
A.^compose;
View stealth-iterables.raku
my @types =
Q{AST},
Q{Allomorph},
Q{Any},
Q{Array},
Q{Associative},
Q{Attribute},
Q{Awaitable},
Q{Awaiter},
Q{Backtrace},
View gist:0df500d560d3e59a2360162a3a3bad6a
class C {
multi method m(Int $i) { $i + 1 }
}
C.^methods.classify(*.name)<m>[0].add_dispatchee(my method m(Int() $i) { self.m($i) });
C.new.m("41").say;
View parallel-shifty.raku
use v6.d;
class Shifty does Positional does Iterable {
has Channel:D $.channel is required;
has $.open is rw = True;
method shift {
LEAVE $.open = False if self.channel.closed;
self.channel.receive;
}
method iterator {
View hyperize.raku
use v6.*;
{
multi sub hyperize(&code, '«') {
sub (@little, @large) {
((@little xx *).flat Z @large).flat.map(&code)
}
}
my &hyper-assume = hyperize({&^a.assuming($^b)}, '«');
View hyperize.raku
use v6.*;
{
multi sub hyperize(&code, '«') {
sub (@little, @large) {
((@little xx *).flat Z @large).flat.map(&code)
}
}
my &hyper-assume = hyperize({&^a.assuming($^b)}, '«');