Skip to content

Instantly share code, notes, and snippets.

View awwaiid's full-sized avatar

Brock Wilcox awwaiid

View GitHub Profile
my @games = (
(name => "Villanova", seed => 1),
(name => "MSM", seed => 16),
(name => "Wisconsin", seed => 8),
(name => "Virginia Tech", seed => 9),
(name => "UVA", seed => 5),
(name => "UNC Wilmington", seed => 12),
(name => "Florida", seed => 4),
(name => "ETSU", seed => 13),
#!/usr/bin/env ruby
puts "I am the great ORACLE!!"
puts
puts "Ask me any question, if you dare!"
puts "BUT BEWARE!!!!"
puts
puts "You may not like the answer."
puts
class Template
def initialize(&block)
@body = block
end
def method_missing(v)
@params[v]
end
module Test::QuickCheck {
multi gen(Int) { 1000000.rand.Int }
our sub verify-one( &f, &predicate ) {
my @params = &f.signature.params.map: -> $p {
# say "Param: {$p.gist}";
gen($p.type)
};
# signal(SIGINT).tap: {
# note "Took { now - INIT now } seconds. $*THREAD";
# }
my $interrupt = signal(SIGINT);
$interrupt.tap: -> $v {
note "[got interrupt $v]";
}
sub catch-control {
CONTROL {
die "Caught a CONTROL ({.gist})";
}
die "forced exception";
}
for 1 {
catch-control;
sub no-catch-control {
die "no-catch-control exception";
}
sub catch-control {
CONTROL {
say "CONTROL: {$_.gist}";
die "control exception";
}
sub no-catch-control {
die "no-catch-control exception";
}
sub catch-control {
CONTROL {
say "CONTROL: {$_.gist}";
die "control exception";
}
> 5+5
10
> next
CONTROL: Died with CX::Next
EXCEPTION: control exception
in sub eval at simple-repl.p6 line 8
in block <unit> at simple-repl.p6 line 34
> last