Skip to content

Instantly share code, notes, and snippets.

View titsuki's full-sized avatar

Itsuki Toyota titsuki

View GitHub Profile
class TypeHouse {
has Int @.array;
has $!scalar;
has @.mystery;
}
my @types = TypeHouse.^attributes(:local);
for @types { .type.say }
use v6;
my $email = 'john.doe@perl6.org';
my $regex = / <:L>+\.<:L>+\@<:L+:N>+\.<:L>+ /;
if $email ~~ $regex {
say $/ ~ " is a valid email";
} else {
say "This is not a valid email";
}
use Inline::Perl5;
my @p5 = Inline::Perl5.new xx 10;
my @promises = @p5.list.kv.map: -> $i, $p5 {
start {
$p5.run(q'
sleep $i;
print "hello world: $i","\n";
$i;
');
travis_fold:start:worker_info
Worker information
hostname: i-09cd11f-precise-production-2-worker-org-docker.travisci.net:9aac324a-c836-47d0-b0ec-d40de3e6628f
version: v2.5.0 https://github.com/travis-ci/worker/tree/da3a43228dffc0fcca5a46569ca786b22991979f
instance: 1fb08c5:travis:default
startup: 585.185344ms
travis_fold:end:worker_info
travis_fold:start:system_info
Build system information
Build language: perl6
@titsuki
titsuki / 5.3.issue.nqp
Created January 14, 2018 00:35
5.3.issue.nqp
use NQPHLL;
grammar NQP::Grammar is HLL::Grammar {
token TOP {
:my $*CUR_BLOCK := QAST::Block.new(QAST::Stmts.new());
<statementlist>
}
rule statementlist { [ <statement> \n+ ]+ }
proto token statement {*}
@titsuki
titsuki / input.php
Created January 14, 2018 00:35
input.php
$emotion = "awesome";
echo "PHP is " . $emotion . "\n";
$emotion = $emotion . "st";
echo "Perl 6 is ". $emotion . "\n";
function greet($name) { echo "Good day, " . $name . "\n"; }
greet("Lena");
itoyota@debian:~/Program/cro-websocket$ PERL6LIB=lib prove -v -r --exec=perl6 t/websocket-client.t
t/websocket-client.t ..
ok 1 - Cannot send anything to closed channel(by done)
ok 2 - Empty ping is recieved
ok 3 - Ping is recieved
ok 4 - Timeout breaks ping promise
ok 5 -
ok 6 - The connection is closed by close() call
ok 7 - Cannot send anything to closed channel by close() call
ok 8 - Can send Hash using client with JSON body serializer installed
my $proc = Proc::Async.new('perl6', '-e', 'warn "end"');
my $promise = $proc.start;
$proc.kill;
await Promise.allof($promise, Promise.in(0).then: { "hello".say; });
$promise.status.say;
@titsuki
titsuki / 23.5.md
Last active August 22, 2019 11:21
Tapl勉強会 201908

23.5 基本的な性質

  • 保存: Γ|-t:Tかつt->t'ならば Γ|-t':T

  • 進行: tが閉じた、正しく型付けされた項ならば、tは値であるか、さもなくばあるt'が存在してt->t'となる

  • 正規化: すべての正しく型付けされたプログラムの評価は停止する

23.6 型消去、型付け可能性、型再構築

  • SystemFは型消去が適用できる
$ PID=`ps aux | grep perl6 | grep books | awk '{ print $2 }'`; lsof -p $PID
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
moar 28830 itoyota cwd DIR 8,18 4096 58854575 /home/itoyota/Programs/p6-App-OpenBD
moar 28830 itoyota rtd DIR 8,18 4096 2 /
moar 28830 itoyota txt REG 8,18 17720 43912060 /home/itoyota/.p6env/versions/rakudo-star-2018.10/bin/moar
moar 28830 itoyota mem REG 8,18 26757 58855051 /home/itoyota/Programs/p6-App-OpenBD/lib/.precomp/9D14E9C9AC11D2C443B018ECF904F75183F146A0/98/98FA1BB2DE90FB1E914476E5C57DFA8F10E6B321
moar 28830 itoyota mem REG 8,18 132363 49677345 /home/itoyota/.p6env/versions/rakudo-star-2018.10/share/perl6/site/precomp/9D14E9C9AC11D2C443B018ECF904F75183F146A0/70/70454FBDA629C3AFDF77696B5F5DAF9871C15B73
moar 28830 itoyota mem REG 8,18 27550 52168106 /home/itoyota/.p6env/versions/ra