タグ

perl6に関するtzccinctのブックマーク (9)

  • Bugs in Hello World

    Posted on March 08, 2022 Hello World might be the most frequently written computer program. For decades, it's been the first program many people write, when getting started in a new programming language. Surely, this humble starting-point program should be bug free, right? After all, hello world programs only do one thing. How could there be a bug? Hello world in C There are a lot of different way

  • 2017年夏のPerl

    6. 正規表現中の { の 扱いが変更に 5.16 で廃止、 5.22 以降警告が出ていたの が 5.26 では死ぬように $foo =~ /d{1,10}/; # ok $foo =~ /d{1}/; # ok $foo =~ /something{}/; # 5.26 ではエラー $foo =~ /something[{]/; # ok $foo =~ /something{/; # ok $foo =~ /{}/; # これも ok 7. 正規表現中の { の 扱いが変更に $foo =~ /$hash{bar}/; # ok $foo =~ /$notahash{}/; # 5.26 ではエラー $foo =~ /${$foo}/; # ok ( デリファレン ス ) $foo =~ /${${foo}}/; # ok ( デリファレン ス ) $foo =~ /$foo/; #

    2017年夏のPerl
  • Perl6 のフィボナッチ数列生成についての解説 - tokuhirom's blog

    mattn ブログで紹介されている Perl6 のフィボナッチ数列が奇妙に見える人が多いようなので、まともな解説。 ref. http://mattn.kaoriya.net/software/lang/perl6/20151026144119.htm フィボナッチ数列とは以下のような数列です。 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 最初の2つの数字が 1, 1 でして、その後のものは直前2つの数字を足したものです。 よって、Perl5 で記述した場合、先頭10個のフィボナッチ数列を求めるには以下のようになります。 use v5.16.0; sub fib { state %memo; # 一応 memoize ぐらいはしておく my $n = shift; $memo{$n} //= do { if ($n == 0 || $n == 1) { 1 } els

  • Big Sky :: Perl6 の無限リストとダイナミックバインディングが最強すぎる

    Perl には x 演算子があり、x 3 といった具合に繰り返し回数を付ける事で連続した文字列を簡単に作り出すことが出来る。 say 1 x 3; # 111 say "foo" x 3; # foofoofoo これは Perl5 でもお馴染み。しかし Perl6 の Range は凄い。 say 1 xx 3; # (1 1 1) say "foo" xx 3; # (foo foo foo) 連続した配列要素が作り出せる。それどころか無限リストが作り出せる。 say 1 xx *; # (...) say "foo" xx *; # (...) もちろん無限数列も作れる。 (1 .. *)[^10].perl.say; # (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) fibonacci 数列もこんなに簡単。 (1, 1, *+* ...^ *)[^100].per

    Big Sky :: Perl6 の無限リストとダイナミックバインディングが最強すぎる
  • Big Sky :: Perl6 の grammar で俺言語「しょぼいスクリプト」を作った。

    Perl6 には Grammar という機能があるのですが、これがまた凄いんです。スキャナとトークナイザと処理系が引っ付いている様な物がデフォルトで提供されているんです。 通常はこれらが別の機能として提供されており、プログラミング言語を実装する過程でデータの受け渡しがシームレスではなく、実装を変えたりするのが非常に面倒だったりします。しかしこれが Perl6 という一つの処理系の中で提供されてしまっている為、来であれば数百ステップくらい掛かってしまう俺言語のコードが50ステップ程度で書けてしまいます。 use v6; grammar SyoboiScript::Grammar { token num { <[0..9]>+ } token ident { <[a..z]>+ } token op { '+' || '-' || '*' || '/' } token exp { <iden

    Big Sky :: Perl6 の grammar で俺言語「しょぼいスクリプト」を作った。
  • YAPC::Asia 2015 に参加してきました — KaoriYa

    YAPC::Asia 2015に、個人スポンサーという形で、前夜祭を除く2日間、参加してきました。 聴講させていただいたトークはいずれも面白く、残念ながら聞けなかったトークもきっととても面白かったんだろうなと信じて止みません。予定していたいくつかは、満室で立ち見になってしまいそうだったので、急遽別のに切り替えたりもしたのですが、そうやって替えた先でも新しい発見があったりと、とても充実した2日間でした。 あと特筆すべきなのは各スタッフの仕事ぶりです。スムーズな進行と誘導、大人数を収容しきったWi-Fi、とても美味しいコーヒーがいただけるコーナー、枚挙すればいとまがありません。旗振りの@lestrratさんをはじめ、スタッフの皆様の膨大な労力のおかげで、2日あわせて合計約16時間もの長時間、実に快適に楽しく過ごさせていただきました。あらためてこの場でお礼をのべさせていただきます。ありがとうござ

    tzccinct
    tzccinct 2015/08/23
    「さぁ、ここにどうやって遊ぶかもわからないガラクタがたくさんあるけど、これを好きに組み合わせて、君の好きなように遊んでごらん」
  • http://ifnx.com/blog/forget-perl-6

    Forget Perl 6 From the Wikipedia article about Perl 6: ... Perl 6 appeared in the year 2000 ... As of 2014, multiple Perl 6 implementations are under development, but none of them are considered "complete". In the meantime dozens of other programming languages appeared. Some of them created and developed by a single person or a very small team of people. To make this more obvious I attach a list o

  • Perl 5 to 6 - 例外と制御例外

    これはMoritz Lenz氏のWebサイトPerlgeek.deで公開されているブログ記事"Perl 5 to 6" Lesson 26 - Exceptions and control exceptionsの日語訳です。 原文はCreative Commons Attribution 3.0 Germanyに基づいて公開されています。 エントリにはCreative Commons Attribution 3.0 Unportedを適用します。 Original text: Copyright© 2008-2010 Moritz Lenz Japanese translation: Copyright© 2011 SATOH Koichi NAME "Perl 5 to 6" Lesson 26 - 例外と制御例外 SYNOPSIS try { die "OH NOEZ"; CATC

  • Perl6 Regex Programming with Rakudo

    Ленивые итераторы для разбора разнородных данных. Михаил Озеров. Moscow.pm 6 ...Moscow.pm

    Perl6 Regex Programming with Rakudo
    tzccinct
    tzccinct 2010/12/19
    マッチ失敗 {fail}
  • 1