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
#!perl | |
package Alias::Shift; | |
require Devel::LexAlias; | |
use strict; | |
use warnings; | |
my $skip; | |
sub shifter { | |
my ( $pack, $ref, @attr ) = @_; |
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
#!perl | |
package CPPish; | |
use Devel::LexAlias; | |
use Attribute::Handlers; | |
use strict; | |
use warnings; | |
my $deparser = CPPish::D->new(-1); | |
our $processing; |
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
package Method::LexicalFields; | |
use fields (); | |
use strict; | |
use warnings; | |
use Devel::LexAlias; | |
use Attribute::Handlers; | |
use Scalar::Util::Hash qw(lock_value); | |
my $vname_re = qr[[%$@][[:alpha:]]\w*]i; | |
my $field_re = qr[_?$vname_re]; |
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
+"(*+*)*(*+* +*/*) **** ** * * *+*+*/* **** ** * * | |
*+*-*/* **** ** * * *+* ****-* **** ** * * *-(*-*/ | |
*) ** (*+*/*) **** ** * * *-* **** ** * * *-*+*/* | |
**** ** * * *+* **** ** * * *-* * * ***((* - */*) | |
** * * *-*/*) * * **** ** * * *+*/* ****-* ***(*-* | |
/*)**(*+*/*) * * ***((*-*/*)** * * *-*/*) * * **** | |
** * * *+*/* **** ** * * *+*+*/*-* * *".split(<***> | |
).map: {.(|(<* * *>xx.count)).chr.print given EVAL | |
"(* ** *+*+*-*/*+$_)" } |
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
use v6; | |
sub primes-list(Bool $use-wheel) { | |
my @start = $use-wheel ?? (2, 3) !! (2); | |
my @sieve; | |
my $i = @start-1; | |
my $p = @start[$i]; | |
my $q = $p*$p; | |
my $n = $p; | |
my \incr = $use-wheel ?? 2 !! 1; | |
@start, -> *@primes { |
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
#!/usr/bin/env perl6 | |
use v6; | |
sub sort-promise ($c) { | |
my @same; | |
earliest $c { | |
more $c { push @same, $c.receive } | |
done $c { return } | |
} | |
my @chans = Channel.new xx 2; |
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
#!/usr/bin/env perl6 | |
use v6; | |
sub sort-promise ($in, $out) { | |
start { | |
my @same; | |
earliest $in { | |
more * { push @same, $in.receive } | |
done * { return } | |
} | |
my ($less_c, $more_c) = Channel.new xx 2; |
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
#!/usr/bin/env perl6 | |
use v6; | |
sub mysort( Supply $s ) { | |
my (@same, @supplies, @promises); | |
my $p = Promise.new; | |
$s.tap( -> $val { | |
if @same { | |
given $val <=> @same[0] { | |
when Same { push @same, $val } | |
when Less { @supplies[0].emit( $val ) } |
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
use v6; | |
class Cache::LRU { | |
has Hash[Node] %.entries; | |
has Node $.lru; | |
class Node { | |
has $value is required; | |
has $prev is rw; | |
has $next is rw; | |
method splice() { |
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
use v6; | |
constant DEBUGGING = False; | |
my class P does Iterator { | |
has @!outbuf = (2, 3); | |
has @!primes; | |
has @!factors; | |
has $!a-prime = 3; | |
has $!a-squared-prime = $!a-prime ** 2; | |
has $!maybe-prime = 3; | |
method !mark-next-multiple( \factor ) { |
OlderNewer