This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source: | |
BEGIN { say 'Before "use OpenGL:from<Parrot>;"' } | |
use OpenGL:from<Parrot>; | |
BEGIN { say 'After "use OpenGL:from<Parrot>;"' } | |
say 'Running regular code' | |
Instrumented result: | |
Perl6::Compiler.import('Any', ...); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ChangeLog: * experimental mmap IO layer for slurping files | |
ChangeLog: * Experimental support for "make install" | |
ChangeLog: * Experimental freeze/thaw code for some PMC types | |
ChangeLog: * Experimental struct handling | |
ChangeLog: * Experimental network socket interface code and opcodes | |
ChangeLog: Wildly experimental patch to make Parrot compile on FreeBSD. (And | |
compilers/pirc/src/pircompunit.c:is experimental, and not actually used at this point. | |
config/gen/makefiles/root.in:# directory for the (experimental) PIR code compiler | |
Configure.pl:This option is experimental. See F<config/init/defaults.pm> for more. | |
docs/pdds/pdd19_pir.pod:The C<:instanceof> pragma is an experimental pragma that creates a sub as a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
multi quicksort([$head, *@front, $mid, *@back, $tail]) { | |
my ($pivot, @others) := median-of-three($head, $mid, $tail); | |
my @rest := |@others, |@front, |@back; | |
quicksort(@rest.grep(* < $pivot)), | |
$pivot, | |
quicksort(@rest.grep(* >= $pivot)) | |
} | |
multi quicksort([$a, $b]) { $a < $b ?? $a, $b !! $b, $a } | |
multi quicksort(@a [$a?]) { @a } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! parrot-nqp | |
INIT { | |
pir::load_language('parrot'); | |
pir::load_bytecode('kakapo_full.pbc'); | |
} | |
class Test::Sanity is UnitTest::Testcase; | |
INIT { use('UnitTest::All'); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Dist::Zilla::Plugin::ScpUpload; | |
# ABSTRACT: Release a dist by uploading it with scp | |
use Moose; | |
use Moose::Autobox; | |
with 'Dist::Zilla::Role::Releaser'; | |
use IO::Handle; | |
use IPC::Open3; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: | |
./test-usage | |
./test-usage name | |
./test-usage age rank [serial-number] | |
./test-usage [--eyes=<Any>] [--hair=<Any>] [--toes=<Int>] | |
./test-usage --toes=<Int> [--smug] [--e|--eyes=<Color>] [--h|--ha|--hai|--hair=<Color>] age rank ignored [serial-number] [pos ...] [names ...] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(The following is a brainstorm of things people might want to do with email, in "How do I ...?" format. For cases where the best answer requires Moose or other heavy modules, a second answer with fewer/lighter dependencies would be most appreciated.) | |
"How do I / What's the best way to / What do you use to ..." | |
* verify a purported email address is sane? | |
* parse an email address into smallest parts? | |
* canonify an email address? | |
* parse/canonify a date header? | |
* send a raw email (already stringified and encoded), simply and safely? | |
* send a (possibly templated) simple text email? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Three versions of the sub: the original, a native-types and nqp-heavy version that | |
# should run faster, and a native-types but nqp-light version that is easier to read. | |
# Anyone have more improvements to either of the latter two? | |
# ORIGINAL | |
my sub RANGEPOS($str) { | |
my $pos = $str.chars; | |
while $pos > 0 { | |
$pos--; | |
my str $ch = nqp::substr(nqp::unbox_s($str), nqp::unbox_i($pos), 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Nowhere to go but up ... :-) | |
# Δt is the time actually spent in the tight .Numeric loop; | |
# most of the remainder is spent generating the test strings. | |
# The first three rows of output indicate successful parses; | |
# the Failure() row indicates cases that don't parse correctly. | |
$ time ./perl6 ./test-numeric | |
"Int()" => 7438 | |
"Num()" => 70389 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 'old' is current Rakudo nom implementation of Str.Numeric() | |
# 'new' is WIP rewrite | |
# Time to complete tight loop of .Numeric() calls | |
PERF TEST Δt-old = 7.82440400123596 | |
PERF TEST Δt-new = 10.397479057312 | |
# Comparison of conversion quality; ideal is diagonal matrix. |
OlderNewer