Perl   2011/02/26@NagoyaRubyKaigi02    id:clairvy
•• PHP / Java / Git / Subversion  • Zsh + Screen + Emacs + Eclipse• Nagoya.pm / CSNagoya• Mixi          PS
“Ruby                                 Rubyists                          ?                   Ruby                          ...
“           ”      9726-
•• PHP / Java / Git / Subversion • Zsh + Screen + Emacs + Eclipse• Nagoya.pm / CSNagoya•Mixi          PS
Perl
•    (Wikipedia -   )•
•••••
1   (ry
Monday
in Ruby
Object   #Object        C        #C        D        #Dobj   #obj
Simple
in Perl
>   >
obj   Roles   Parents
obj   Roles   Parents
Multiple Inheritance
P11   P12       P21    P21      P1          P2            C
class P11 {   method f {print " P11"} };(     )class C is P1 is P2 {   method f {print "C"} };my $obj = C.new;$obj.+f;# =>...
Tuesday
use MONKEY_TYPING;augment class Str {  method to_an {     my $s = self;     $s ~~ s:g/<-alnum-space>+//;     return $s; }}
use MONKEY_TYPING;augment class Str {  method to_an {     my $s = self;     $s ~~ s:g/<-alnum-space>+//;     return $s; }}
Wednesday
^add_method
○ Class, Role  × Object
Role
my $role = RoleHOW.new;$role.^add_method(‘a’,  my method a { say ‘a’ });$role.^compose;$obj does $role;
methodf($self :defined :)       { ... }
Thursday
Long•function• define• lambda• defun• proc
Long•function• define• lambda• defun• proc
middle•fun• def• {}• -> { }
middle•fun• def• {}• -> { }
Too short
sample
my $zero = ->$f{->$x{$x}};my $addone = ->$n{->$f{->$x{$f($n($f)($x))}}};my $one = $addone($zero);my $add = ->$m,$n{->$f{->...
my $inc = {$^n+1};say zero = , $zero($inc)(0);say one = , $one($inc)(0);say two = , $two($inc)(0);say three = , $three($in...
Friday
for 0..Inf -> $i {   say $i;   last if $i > 17; }
Saturday
TMTOWTDI
in Nagoya
(   )•        Scala (Scala)• Has (Haskell)• Proof Cafe (Coq)• Nagoya.lisp (lisp)• OCaml-Nagoya (OCaml)
And
Nagoya.pm(   )
Nagoya.pm( )
Perlλ
Any Questions?
Perl6
• http://perl-users.jp/articles/advent-calendar/  2010/perl6/• http://d.hatena.ne.jp/uasi/searchdiary?  word=*[Perl6]• htt...
• https://github.com/clairvy/  metaprogramming_ruby
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
Upcoming SlideShare
Loading in...5
×

メタプログラミングPerl nagoya rubykaigi02

2,372

Published on

当日に Ruby 版のソースを乗せた方がいいんじゃね?
という意見をもらったので,更新しますた.

Published in: Technology, Education
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,372
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • メタプログラミングPerl nagoya rubykaigi02

    1. 1. Perl 2011/02/26@NagoyaRubyKaigi02 id:clairvy
    2. 2. •• PHP / Java / Git / Subversion • Zsh + Screen + Emacs + Eclipse• Nagoya.pm / CSNagoya• Mixi PS
    3. 3. “Ruby Rubyists ? Ruby ”http://blog.livedoor.jp/dankogai/archives/51507869.html
    4. 4. “ ” 9726-
    5. 5. •• PHP / Java / Git / Subversion • Zsh + Screen + Emacs + Eclipse• Nagoya.pm / CSNagoya•Mixi PS
    6. 6. Perl
    7. 7. • (Wikipedia - )•
    8. 8. •••••
    9. 9. 1 (ry
    10. 10. Monday
    11. 11. in Ruby
    12. 12. Object #Object C #C D #Dobj #obj
    13. 13. Simple
    14. 14. in Perl
    15. 15. > >
    16. 16. obj Roles Parents
    17. 17. obj Roles Parents
    18. 18. Multiple Inheritance
    19. 19. P11 P12 P21 P21 P1 P2 C
    20. 20. class P11 { method f {print " P11"} };( )class C is P1 is P2 { method f {print "C"} };my $obj = C.new;$obj.+f;# => C P1 P11 P12 P2 P21 P22
    21. 21. Tuesday
    22. 22. use MONKEY_TYPING;augment class Str { method to_an { my $s = self; $s ~~ s:g/<-alnum-space>+//; return $s; }}
    23. 23. use MONKEY_TYPING;augment class Str { method to_an { my $s = self; $s ~~ s:g/<-alnum-space>+//; return $s; }}
    24. 24. Wednesday
    25. 25. ^add_method
    26. 26. ○ Class, Role × Object
    27. 27. Role
    28. 28. my $role = RoleHOW.new;$role.^add_method(‘a’, my method a { say ‘a’ });$role.^compose;$obj does $role;
    29. 29. methodf($self :defined :) { ... }
    30. 30. Thursday
    31. 31. Long•function• define• lambda• defun• proc
    32. 32. Long•function• define• lambda• defun• proc
    33. 33. middle•fun• def• {}• -> { }
    34. 34. middle•fun• def• {}• -> { }
    35. 35. Too short
    36. 36. sample
    37. 37. my $zero = ->$f{->$x{$x}};my $addone = ->$n{->$f{->$x{$f($n($f)($x))}}};my $one = $addone($zero);my $add = ->$m,$n{->$f{->$x{$n($f)($m($f)($x))}}};my $two = $add($one, $one);my $three = $add($two, $one);
    38. 38. my $inc = {$^n+1};say zero = , $zero($inc)(0);say one = , $one($inc)(0);say two = , $two($inc)(0);say three = , $three($inc)(0);
    39. 39. Friday
    40. 40. for 0..Inf -> $i { say $i; last if $i > 17; }
    41. 41. Saturday
    42. 42. TMTOWTDI
    43. 43. in Nagoya
    44. 44. ( )• Scala (Scala)• Has (Haskell)• Proof Cafe (Coq)• Nagoya.lisp (lisp)• OCaml-Nagoya (OCaml)
    45. 45. And
    46. 46. Nagoya.pm( )
    47. 47. Nagoya.pm( )
    48. 48. Perlλ
    49. 49. Any Questions?
    50. 50. Perl6
    51. 51. • http://perl-users.jp/articles/advent-calendar/ 2010/perl6/• http://d.hatena.ne.jp/uasi/searchdiary? word=*[Perl6]• http://perlgeek.de/en/article/5-to-6
    52. 52. • https://github.com/clairvy/ metaprogramming_ruby
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×