Skip to content

Instantly share code, notes, and snippets.

Avatar

Aleks-Daniel Jakimenko-Aleksejev AlexDaniel

  • Tallinn, Estonia
View GitHub Profile
@AlexDaniel
AlexDaniel / ootut2.pm6
Last active March 18, 2020 18:55 — forked from wildwildtrees/ootut2.pm6
bug free, but bugs out when follow is called with "Cannot invoke this object (REPR: Null; VMNull)" if I change self.id to self!id in method follow in role Follow line 52
View ootut2.pm6
our %world = {} ;
role Identifier {
has $.id is rw ;
}
role Container {
has @.contents is rw ;
method add($item) {
@!contents.push($item) ;
@AlexDaniel
AlexDaniel / query
Created October 19, 2019 16:31 — forked from Whateverable/query
greppable6
View query
≠|≤|≥
@AlexDaniel
AlexDaniel / query
Created September 28, 2019 19:02 — forked from Whateverable/query
evalable6
View query
.say for ^888
View role-import.p6
# MAIN
require ($*PROGRAM.parent.absolute ~ "/to_require.pm") <required_role> ;
my $c = 1 does required_role ;
View gist:092458de72b918a2873c4429b427500a
use v6;
my int $max = 2_000_000 × 4;
# find all primes up to $max using The Sieve of Erathostenes
my int @a = (0..$max);
for (2..($max div 2)) -> int $i {
my int $j = 2;
@a[$i * $j++] = 1 while $i * $j <= $max;
}
@AlexDaniel
AlexDaniel / Foo.pm6
Last active October 5, 2018 23:11 — forked from mwienand/Foo.pm6
re-export p6
View Foo.pm6
use FooBar;
module Foo {
sub foo is export { "foo" ~ bar() }
}
sub EXPORT {
FooBar::EXPORT::DEFAULT::
}
@AlexDaniel
AlexDaniel / foo.p6
Last active September 5, 2018 20:29 — forked from bazzaar/gist:914a5c3e6fd69e45de7ecce9d16e360b
for loop with .lines
View foo.p6
#use Slang::Tuxic;
#use Text::CSV;
#use File::Find;
my $csv_line = ‘foo’; # Text::CSV.new (eol => "\n");
my $cols = 49;
my @IO-object-list = < a b c >; #find(:dir</home/user1/documents/animals>, :type<file>, :name(/armadillos_201<[4..8]>.*\.csv/));
for @IO-object-list -> $IO-object {
View gist:227c34f20d638d0b339947c744d05bc8
use v6;
my Int @cache is default(0);
my $sum89 = 0;
for (1..567) -> $i {
@cache[$i] = calc-chain($i);
}
for (1..400_000) -> $i {
@AlexDaniel
AlexDaniel / query
Last active July 13, 2018 12:17 — forked from Whateverable/query
greppable6
View query
if[^{]+=(?!=)[^{]+\{
@AlexDaniel
AlexDaniel / query
Created June 25, 2018 22:57 — forked from Whateverable/query
greppable6