Skip to content

Instantly share code, notes, and snippets.

Avatar

ab5tract ab5tract

  • Amsterdam, Netherlands
View GitHub Profile
@ab5tract
ab5tract / type-subset.t
Created February 14, 2023 21:50
Tests for getting RakuAST::Type::Subset working
View type-subset.t
use v6.d;
use lib <t/packages/>;
use Test;
use Test::Helpers;
plan 10;
subtest "When refinement is an expression value", {
plan 3;
@ab5tract
ab5tract / Raku-Grammar.nqp
Created February 13, 2023 13:05
Failing to parse 'enum'
View Raku-Grammar.nqp
token type_declarator:sym<enum> {
# <sym><.kok>
:my $*IN_DECL := 'enum';
# [
# | <longname>
# | <variable>
# | <?>
# ]
{ $*IN_DECL := '' }
# <.ws>
@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'
View Base
- 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>)
View * && 5
- 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
View raku rationale-matrix.p6 --timings-only 8
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
View file-check.p6
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) }
View secret.diff
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
View rex-extract.p6
#!/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);
View have-to-tap.p6
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
View ua-tester.p6
#!/usr/bin/env perl6
use v6;
use HTTP::UserAgent;
use LWP::Simple;
use Net::Curl;
use Net::Curl::Easy;
use Net::HTTP::GET;