Skip to content

Instantly share code, notes, and snippets.

View ab5tract's full-sized avatar

ab5tract ab5tract

  • Amsterdam, Netherlands
View GitHub Profile
@ab5tract
ab5tract / Base
Last active February 10, 2023 14:31
Differences between base QAST and branch QAST -- 'subset F where * == 5; my F $f = 6'
- QAST::Block(:name(<unit-outer>) :cuid(3)) :in_stmt_mod<?> subset F where * == 5; my F $f = 6
│ - QAST::Var(local __args__ :decl(param))
│ - QAST::Stmts subset F where * == 5; my F $f = 6
│ - QAST::Op(bind)
│ - QAST::Var(lexical RakuAST :decl(var))
│ - QAST::Op(callmethod new)
│ - QAST::Var(lexical Failure)
│ - QAST::Op(callmethod new)
│ - QAST::WVal(X::Experimental)
│ - QAST::SVal+{QAST::SpecialArg}(RakuAST :named<feature>)
- QAST::Block(:name(<unit>) :cuid(1) :blocktype(declaration_static)) :IN_DECL<mainline> * && 5
│ - QAST::Stmts
│ - QAST::Stmts
│ - QAST::WVal(Nil)
│ - QAST::Stmts * && 5
│ - QAST::Var(local __args__ :decl(param))
│ - QAST::Stmts
│ - QAST::Var(lexical !RAKUAST_MARKER :decl(static))
│ [value]
│ - 1
@ab5tract
ab5tract / raku rationale-matrix.p6 --timings-only 8
Last active August 7, 2020 15:33
Hilbert matrix cross product its inversion is a good demonstration of floating point versus rational arbitrary precision
Created 'Num' Hilbert of 8x8: 0s
Created 'Rat' Hilbert of 8x8: 0.0469023s
Starting 'Num' Hilbert test at 2020-08-07T17:32:09.217803+02:00
'Num' Hilbert inverse calculation: 8.0857941s
'Num' Hilbert (is identity? False): 8.0857941s
Starting 'Rat' Hilbert test at 2020-08-07T17:32:17.303597+02:00
'Rat' Hilbert inverse calculation: 5.3155128s
'Rat' Hilbert (is identity? True): 5.331197s
subset NonExistentFile of Str where { ! $_.IO.e }
multi sub check-file (NonExistentFile $file, $force where *.&so) { True }
multi sub check-file (Str $file, $force where { !$_ }) { True }
multi sub check-file (Str $file, $force where *.&so) { False }
my $force = False;
subset PassedCheck of Str where { check-file($_, $force) }
commit 480b4571c09d832fc5dbe63d77b4df33a7c2d1c0
Author: ab5tract <john.haltiwanger@gmail.com>
Date: Thu Oct 17 17:46:33 2019 +0200
Add single-arg target to infix:<+>
diff --git a/pimbook/secret/lib/Secret.pm6 b/pimbook/secret/lib/Secret.pm6
index 379cfc6..eaceba7 100644
--- a/pimbook/secret/lib/Secret.pm6
+++ b/pimbook/secret/lib/Secret.pm6
#!/usr/bin/env perl6
use v6.d;
use REX::File;
use Audio::Sndfile;
sub MAIN(:i(:$in-dir), :o(:$out-dir)) {
mkdir $out-dir unless $out-dir.IO.d;
my (@fails, $total, %words);
my $proc = Proc::Async.new(:r, 'echo',
'Man is amazing, but he is not a masterpiece');
react {
whenever $proc.stdout { say "OUT: $_" }
whenever $proc.start { done }
}
@ab5tract
ab5tract / ua-tester.p6
Last active September 16, 2016 12:17
Test all the P6 user agents
#!/usr/bin/env perl6
use v6;
use HTTP::UserAgent;
use LWP::Simple;
use Net::Curl;
use Net::Curl::Easy;
use Net::HTTP::GET;
@ab5tract
ab5tract / oo-monitors-test.p6
Created August 12, 2016 17:47
OO::Monitors breaks with custom initialization
use v6;
use OO::Monitors;
monitor Grid {
has @!grid;
submethod BUILD() {
@!grid = [23, 42];
}
@ab5tract
ab5tract / test-case.p6
Created August 2, 2016 07:11
minimal-case-for-Array-of-Nums-smartmatch-bug
use v6;
my @tests = [
42.424242 => Buf.new( reverse 0b01000000, 0b01000101, 0b00110110, 0b01001101,
0b10001111, 0b11010101, 0b11001011, 0b01111001),
33.3 => Buf.new( reverse 0b01000000, 0b01000000, 0b10100110, 0b01100110,
0b01100110, 0b01100110, 0b01100110, 0b01100110),
];
my $double-c = q:to/ENDC/;