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
# These are all equivalent: a list of three Pairs | |
@foo = 'one' => 1, 'two' => 'ii', 'one' => { say "ॐ" } | |
@foo = one => 1, two => 'ii', one => { say "ॐ" } | |
@foo = :one(1), :two<ii>, :one({ say "ॐ" }) |
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
var real_docwrite = document.write, | |
body = $('body'); | |
(function insertGists(a_tags) { | |
if (a_tags.length > 0) { | |
a_tag = a_tags.shift() | |
document.write = function(stylesheet) { | |
$('head').append(stylesheet); | |
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
if %attrs<about> { say "\n", $^it } | |
if %attrs<about> -> $it { say "\n", $it } # Same thing |
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
submethod BUILD (:$events!) { | |
$events.listen: | |
'EOF' => { | |
# Safety to prevent infinite loop, in case | |
# the quit-on-undef logic fails | |
unless $*IN.eof { | |
my $input = prompt("\n> "); | |
$events.emit('command', :$input); | |
} | |
}, |
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
my $x = 0; | |
sub foo { | |
my $bt = Backtrace.new; | |
note $x, +@$bt, $bt.end; | |
note $bt[*-1]; | |
note $bt.full(); | |
foo() if ++$x < 10; | |
} |
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
class Foo { | |
has $.foo; | |
method foo { | |
# Change this to $!foo, and compilation errors appropriately: | |
# "Cannot assign to a readonly variable or a value" | |
return $.foo; | |
} | |
} |
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
Sampling process 55493 for 3 seconds with 1 millisecond of run time between samples | |
Sampling completed, processing symbols... | |
Analysis of sampling perl6 (pid 55493) every 1 millisecond | |
Process: perl6 [55493] | |
Path: /Users/tim/g/code/p6/rakudo/install/bin/perl6 | |
Load Address: 0x100000000 | |
Identifier: perl6 | |
Version: ??? (???) | |
Code Type: X86-64 (Native) | |
Parent Process: sh [55492] |
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
=begin pod | |
In other words, C<.WHY> and C<.WHEREFORE> are inverse operations: | |
.WHY | |
---------------------------- | |
| | | |
| v | |
----------------- ----------------- | |
| Declared code | | Documentation | |
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
#! /usr/bin/env perl6 | |
# vim:set ft=perl6: | |
sub print-pod(Pod::Block $pod, $level = 0) { | |
my $leading = ' ' x $level; | |
my %confs; | |
for <config name level caption type headers> { | |
my $thing = $pod.?"$_"(); | |
if $thing { | |
%confs{$_} = $thing ~~ Iterable ?? $thing.perl !! $thing.Str; |
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
=begin table :caption('The Other Guys') | |
Secret | |
Superhero Identity Superpower | |
============= =============== =================== | |
B<The Shoveller> Eddie Stevens King Arthur's | |
singing shovel | |
Blue Raja Geoffrey Smith Master of cutlery | |
=end table |