Skip to content

Instantly share code, notes, and snippets.

@Mouq
Mouq / gist:7328659
Last active December 27, 2015 12:49
use v6;
grammar UnixPath {
token TOP { ^ [<context> '/']? (<name>|<glob>) +%% '/' $ }
proto token context {*}
token context:sym<~> { <sym> <?[/]> }
token context:sym</> { <?[/]> }
token name { <-[ * / ]>+ }
token glob { $<initial>=['*'?] [<name> '*']+ <final=.name>? }
}
@Mouq
Mouq / gist:7327211
Created November 5, 2013 22:09
Types missing from docs
∘ Baggy
∘ Bag
∘ CallFrame
∘ Dateish
∘ DateTime
∘ Enumeration
∘ GatherIter
∘ IO::FileTestable
∘ IO::ArgFiles
∘ IO::Path
@Mouq
Mouq / gist:7130628
Last active December 26, 2015 09:39
  • test(abc)

Test will abc whatever you paren!!

  • (abc)test

Deprecated.

# Attempt at making the program correct, though it makes
# the program run 4.5 times slower (on my machine).
# In fact, I think it works because the threads
# spend so much time updating the hash
# that the chance of them both selecting the same
# indices AND executing the swap at the same time
# are made an order of magnitude more negligible.
use v6;
sub run (Int $vecs, Int $items, Int $threads, Int $iters) {
@Mouq
Mouq / gist:6594765
Last active December 23, 2015 06:29
use v6;
use File::Find;
token fudge-declaration { ^^ "#?rakudo" .*? $$ }
token test
{
[
| "is"
| "isnt"
class Recursive {
has $.r;
class Recursive::Stub is Recursive {
submethod BUILD {}
}
submethod BUILD {
$!r = Recursive::Stub.new;
}
}
src/core/CallFrame.pm
9: my Mu $interp := pir::getinterp__P;
src/core/control.pm
11: pir::setattribute__vPsP($ex, 'severity', pir::const::EXCEPT_NORMAL);
144: nqp::bindattr($ex, Exception, 'severity', nqp::p6box_i(pir::const::EXCEPT_WARNING));
174: pir::spawnw__IP(
202: pir::spawnw__Is(nqp::unbox_s($cmd)),
src/core/Exception.pm
@Mouq
Mouq / test.pl
Last active December 20, 2015 13:49
$ mkdir mod_test && cd mod_test
$ mkdir lib
$ curl http://modules.perl6.org/proto.json > proto.json
$ export PERL6LIB=$PWD/lib:PERL6LIB
$ export PREFIX=$PWD/lib
$ perl test.pl