The Synopsis documents are the design documents used toguidePerl 6 language, compiler, and test development. As design documents, they're frequently subjected to the rigors of cross-examination through implementation and use in practice. In other words, they may change slightly or radically, but the expectation is that they are ``very close`` to the finalshape ofPerl 6. In the past the Synopse
2011-03-19: 複数行コメントについて加筆しました。 背景Perlにもしあったらいいなぁと思う機能 - サンプルコードによるPerl入門を読んでて「それPerl6でできるよ」と思ったので。一応Perlです。一応。 1. ダブルクォーテーションの中で関数が展開できる機能 ダブルクォート(qq演算子)はエスケープシーケンス、スカラ、配列、ハッシュ、関数、クロージャを展開します: "aaa { $book.title } bbb" Qクォート演算子でオレオレ展開ルールも作れます(Rakudoだとまだ動きませんが): Q:function/funcall: &func()/; Q:closure/closure: { ucfirst('hello') ~ ', world' }/; # qq//と同じ Q:qq/$scalar, @array[], %hash{}, &subroutin
これはMoritz Lenz氏のWebサイトPerlgeek.deで公開されているブログ記事"Perl 5 to 6" Lesson 16 - Enumsの日本語訳です。 原文はCreative Commons Attribution 3.0 Germanyに基づいて公開されています。本エントリにはCreative Commons Attribution 3.0 Unportedを適用します。 Originaltext: Copyright© 2008-2010 Moritz LenzJapanese translation: Copyright© 2011 SATOH Koichi NAME "Perl 5 to 6" Lesson 16 - 列挙型 SYNOPSIS enum bit Bool <False True>; my $value = $arbitrary_value
5日目の「[/articles/advent-calendar/2010/perl6/5:title=モジュールを書いてみよう]」は読みましたか?モジュール書いてみましたか?もう書いた?すばらしい! そうすると次は……公開してみたくなりますよね? まだ書いていない人も……何か書きたい!公開したい!と思いませんか? 今日はそんな人のために、Perl 6 モジュールを公開して に登録するまでのステップを説明します。 0. モジュールを書こう 何はなくともモジュールを書きましょう。実用的なものを書くもよし、Perl 5 や他の言語のモジュールを移植するのも勉強になりますし、おふざけモジュールだってかまいません。 適当なディレクトリ(以下 $project とします)を作って、モジュールを $project/lib 以下に置きます。 依存するPerl 6 のモジュールがあるなら、 $proj

http://perl6advent.wordpress.com/2010/12/10/day-10-feed-operators/ Unixのパイプラインって左から右に流れる: cat hoge.log | grep foo | sed 's/.*foo//' | cut -f2 | sort | uniq -c ところが、perlのパイプと言うかリスト処理のチェーンは右から左に流れる。 my @new = sort { ... }map { ... } grep { ... } @original;関数の組合せは右から左なので仕方ない。しかしシックリこない。Perl6には「feed operator」ってのがあって、方向を明示的に表わす: my @new <== sort { ... } <==map { ... } <== grep { ... } <== @original;
この記事は"Perl6 Advent Calendar"をエスパー和訳したものです。大意は合っていると思われるものの、内容は保証しません。 <原文> 二日目 - コマンドラインとMAIN関数の交流 (原文/Moritz) Day 2 – Interacting with the commandline with MAIN subs By Moritz Unix環境では、多くのスクリプトがコマンドラインから引数やオプションを受け取ります。Perl6では、とても簡単にこれらを受け取ることができます。 In Unix environment, many scripts take arguments and options from the commandline. WithPerl 6it’s very easy to accept those: $ cat add.pl sub MAI

Shellのシングルクォートはエスケープしないのでシングルクォートの中でシングルクォートを利用することができない。 Enclosing characters in single-quotes ( '' ) shall preserve the literal value of each character within the single-quotes. A single-quote cannot occur within single-quotes. Shell Command Language 例えば以下は内部のシングルクォートはエスケープされておらずシングルクォートを一旦とじてまた開いた状態になっている $ echo 'That\'s right' >以下のようにすれば意図通りに出力できるんだけどもめんどい $ echo 'That'\''s right' That's right
Perl 6 ではインスタンスメソッドとクラスメソッドは区別されません。オブジェクトのアトリビュートをアクセスしていないメソッドはすべてクラスメソッドとして呼ぶことができます。 class C { method hello() { say 'hello'; } has $!aisatsu = 'konnichiwa'; method konnichiwa() { say $!aisatsu; } } C.new.hello; # => hello C.hello; # => hello C.new.konnichiwa; # => konnichiwa # C.konnichiwa #Error: Type objects are abstract and have no attributes, but you tried to access $!aisatsu メソッドがクラスに対して
Loading… Flash Player 9 (or above) is needed to view presentations. We have detected that you do not haveit on your computer. To installit,go here.Perl6regex - Presentation Transcript !"#"$ “ ” !"#"$ !"#"$ %& '( ) *+," -./01 2!345 63$ 7.%8"9 3:"! +," +," ;<=& 93#*> !" #$ %% &' ( )*+, -+ #. / ' 0 $12 345678 9#.9 :*!;< !7 1 =5*3> ? !" 9@=5@<=A29 %% &' @<=A ' 0 $12 39@=5@<=A29 ;57:1!7$ 9@<=A93> ?
■_ LL Tiger 行ってきました。速報はこのあと! (みねこあさんはスルーだったのかな) unixコマンド0 true C 0以外 true ■_ LL Tiger » タイムスケジュール タイムスケジュール 10:00 開場 10:25-10:30 開会宣言 10:30-11:50 Language Update 11:50-12:00 休憩 12:00-13:00 開発ライセンスとプログラマーの自由 13:00-14:30 昼休み 14:30-15:30 LTの虎・1回戦 15:30-16:30 LLと電子出版 16:30-17:00 夕休み 17:00-18:00 LLでフィジカルコンピューティング 18:00-18:30 LTの虎・準決勝 18:30-18:40 休憩 18:40-19:40 高速化虎の巻 19:40-20:00 LTの虎・決勝 20:00-20:10 抽選会
たとえばこんな。 Rakudo Star ではどれも実装済み。今すぐ使えます。 強化された正規表現Perl 6 の公式なパーサ自体もPerl 6 の正規表現で書かれています。 ……は置いといて。10行ちょっとでCSV をパースする正規表現が書ける。クォートされた値にも複数行にまたがる値にも対応。 #CSV クラスは以下のものを修正して使っています # http://github.com/masak/csv/blob/master/lib/Text/CSV.pm # 正規表現をまとめた grammar (クラスの一種) grammarCSV { regexTOP { ^ <line> ** \n <empty_line>? $ } regexline { <value> ** ',' } regex value { | <pure_text> | \s* \" <quoted_
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く