This file contains 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/perl | |
use strict; | |
use warnings; | |
my ( @count, @remainder ); | |
sub build_string | |
{ |
This file contains 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
#!perl6 | |
use v6; | |
=begin code | |
Original perl 5 | |
s/\\E/\033/g; | |
s/\\(\d\d\d)/pack('c',oct($1) & 0177)/eg; |
This file contains 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
{ | |
"file-count" : 107, | |
"dist-count" : 7, | |
"dists" : [ | |
{ | |
"id" : 0, | |
"name" : "File::Find", | |
"auth" : null, | |
"ver" : "*", | |
"description" : "Bla bla", |
This file contains 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
#!perl6 | |
use v6; | |
# From Björklund via http://cgm.cs.mcgill.ca/~godfried/publications/banff.pdf | |
class Euclid | |
{ | |
method build_string(Int $level, @count, @remainder ) | |
{ |
This file contains 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
#!perl6 | |
use v6; | |
class Foo { | |
has $!foo_str; | |
method foo is rw { | |
Proxy.new( | |
FETCH => { |
This file contains 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
use v6; | |
use NativeCall; | |
class Utsname is repr('CStruct') { | |
has Str $.sysname; | |
has Str $.nodename; | |
has Str $.release; | |
has Str $.version; | |
has Str $.machine; |
This file contains 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 $c = Channel.new; | |
await (^10).map: { | |
start { | |
my $r = rand; | |
sleep $r; | |
$c.send($r); | |
} | |
} | |
$c.close; |
This file contains 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
Given: | |
lib/Pack.pm: | |
class Pack { | |
use Pack::Util::Collection; | |
our $collection; | |
This file contains 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
( | |
gather { | |
my $c = Channel.new; | |
my @ps = do for ^10 { start { sleep rand; $c.send($_) } }; | |
my $p = Promise.allof(@ps); | |
loop { | |
earliest $c { | |
more * { | |
take $_; | |
} |
This file contains 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
use v6; | |
use NativeCall; | |
my @buff := CArray[num64].new; | |
my @in = (^100).map({Num($_)}); | |
for ^100 -> $i { | |
@buff[$i] = @in[$i]; |
OlderNewer