Skip to content

Instantly share code, notes, and snippets.

View AlexDaniel's full-sized 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
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
≠|≤|≥
@AlexDaniel
AlexDaniel / query
Created September 28, 2019 19:02 — forked from Whateverable/query
evalable6
.say for ^888
# MAIN
require ($*PROGRAM.parent.absolute ~ "/to_require.pm") <required_role> ;
my $c = 1 does required_role ;
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
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
#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 {
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
if[^{]+=(?!=)[^{]+\{
@AlexDaniel
AlexDaniel / query
Created June 25, 2018 22:57 — forked from Whateverable/query
greppable6
\<\-\>