Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Streem

 Streem

東京Ruby会議11 招待講演

0ec4920185b657a03edf01fff96b4e9b?s=128

Yukihiro Matsumoto

May 28, 2016
Tweet

Transcript

  1. Powered by Rabbit 2.1.8 Streem 日経Linuxライター @yukihiro_matz まつもと ゆきひろ Yukihiro

    "Matz" Matsumoto
  2. Powered by Rabbit 2.1.8   まつもとゆきひろ

  3. Powered by Rabbit 2.1.8   Ruby

  4. Powered by Rabbit 2.1.8   プログラマ

  5. Powered by Rabbit 2.1.8   言語デザイナー

  6. Powered by Rabbit 2.1.8   日経Linuxライター

  7. Powered by Rabbit 2.1.8   作りながら学ぶプログラミング言語

  8. Powered by Rabbit 2.1.8   言語デザイン

  9. Powered by Rabbit 2.1.8   言語実装

  10. Powered by Rabbit 2.1.8   プロ(?)デザイナーの技

  11. Powered by Rabbit 2.1.8   書ける人が他にいない

  12. Powered by Rabbit 2.1.8   Streem

  13. Powered by Rabbit 2.1.8   教材・例題

  14. Powered by Rabbit 2.1.8   言語デザイン

  15. Powered by Rabbit 2.1.8   言語実装

  16. Powered by Rabbit 2.1.8   どんな言語?

  17. Powered by Rabbit 2.1.8   ポジション

  18. Powered by Rabbit 2.1.8   汎用言語を目指さない

  19. Powered by Rabbit 2.1.8   まつもと=Rubyのひと

  20. Powered by Rabbit 2.1.8   「まつもとがRubyをあきらめた」

  21. Powered by Rabbit 2.1.8   Rubyの発展の邪魔になりたくない

  22. Powered by Rabbit 2.1.8   実験

  23. Powered by Rabbit 2.1.8   教材

  24. Powered by Rabbit 2.1.8   特定目的言語

  25. Powered by Rabbit 2.1.8   可能であればRubyと変える

  26. Powered by Rabbit 2.1.8   異なる設計判断

  27. Powered by Rabbit 2.1.8   妥協できない点の明確化

  28. Powered by Rabbit 2.1.8   20年の経験の反映

  29. Powered by Rabbit 2.1.8   関数型(的)プログラミング

  30. Powered by Rabbit 2.1.8   イミュータブルデータ

  31. Powered by Rabbit 2.1.8   コンカレンシー

  32. Powered by Rabbit 2.1.8   プログラミングモデル

  33. Powered by Rabbit 2.1.8   ストリーミングプログラミング

  34. Powered by Rabbit 2.1.8   ループがない

  35. Powered by Rabbit 2.1.8   endがない

  36. Powered by Rabbit 2.1.8   ピタゴラスイッチ・プログラミング Rube Goldberg Programming

  37. Powered by Rabbit 2.1.8   実例

  38. Powered by Rabbit 2.1.8   Cat

  39. Powered by Rabbit 2.1.8   stdin | stdout cat pipeline

  40. Powered by Rabbit 2.1.8   stdin = read I/O

  41. Powered by Rabbit 2.1.8   stdout = write I/O

  42. Powered by Rabbit 2.1.8   read I/O | write I/O

  43. Powered by Rabbit 2.1.8   task(read I/O) | task(write I/O)

  44. Powered by Rabbit 2.1.8   task(read I/O) producer epoll(2) read(2)

    queue push
  45. Powered by Rabbit 2.1.8   task(write I/O) consumer queue pop

    write(2)
  46. Powered by Rabbit 2.1.8   Hello World

  47. Powered by Rabbit 2.1.8   ["Hello World"] | stdout hello

    world
  48. Powered by Rabbit 2.1.8   配列はproducerになる

  49. Powered by Rabbit 2.1.8   Socket connection

  50. Powered by Rabbit 2.1.8   # simple echo server on

    port 8007 tcp_server(8007) | each{|sock| sock | sock } simple echo server
  51. Powered by Rabbit 2.1.8   tcp_server = tcp_server task

  52. Powered by Rabbit 2.1.8   each task

  53. Powered by Rabbit 2.1.8   sock I/O | sock I/O

  54. Powered by Rabbit 2.1.8   tcp_server task producer accept(2) create

    socket I/O queue push
  55. Powered by Rabbit 2.1.8   each task filter (consumer) queue

    pop call function
  56. Powered by Rabbit 2.1.8   # simple netcat on port

    8007 sock = tcp_socket("localhost", 8007) stdin | sock sock | stdout simple netcat client
  57. Powered by Rabbit 2.1.8   FizzBuzz

  58. Powered by Rabbit 2.1.8   # seq(100) returns a stream

    of numbers from 1 to 100. # stdout is an output destination. seq(100) | map{|x| if (x % 15 == 0) "FizzBuzz" else if (x % 3 == 0) "Fizz" else if (x % 5 == 0) "Buzz" else x } | stdout
  59. Powered by Rabbit 2.1.8   スケジューラー

  60. Powered by Rabbit 2.1.8   コア数のスレッド

  61. Powered by Rabbit 2.1.8   スレッドループ ループ タスクキューから取り出し 実行 全ストリーム終了まで

  62. Powered by Rabbit 2.1.8   FizzBuzz

  63. Powered by Rabbit 2.1.8   # simple netcat on port

    8007 sock = tcp_socket("localhost", 8007) stdin | sock sock | stdout simple netcat client
  64. Powered by Rabbit 2.1.8   オブジェクト指向

  65. Powered by Rabbit 2.1.8   foo.bar => bar(foo)

  66. Powered by Rabbit 2.1.8   namespace

  67. Powered by Rabbit 2.1.8   namespace { ... }

  68. Powered by Rabbit 2.1.8   new namespace(args)

  69. Powered by Rabbit 2.1.8   bar(foo)

  70. Powered by Rabbit 2.1.8   bar(foo) fooのnamespaceにbarがあれば なければ変数barを実行

  71. Powered by Rabbit 2.1.8   bar(foo) barが無名関数なら実行 barがC関数なら実行 barが配列ならx(0)で先頭要素

  72. Powered by Rabbit 2.1.8   Lisp1.5

  73. Powered by Rabbit 2.1.8   総称関数を導入したい

  74. Powered by Rabbit 2.1.8   Lisp1

  75. Powered by Rabbit 2.1.8   ライブラリ

  76. Powered by Rabbit 2.1.8   少しずつ充実させてる

  77. Powered by Rabbit 2.1.8   seq/repeat/rand map/each time csv stat/math/sort

  78. Powered by Rabbit 2.1.8   seq/repeat/rand

  79. Powered by Rabbit 2.1.8   Producers seq(10) rand(10) repeat(v, 10)

    cycle([v1,v2], 10)
  80. Powered by Rabbit 2.1.8   Producers zip(strm1,strm2) concat(strm1,strm2)

  81. Powered by Rabbit 2.1.8   map/each

  82. Powered by Rabbit 2.1.8   Filters map{|x| x*2} flatmap{|x| x*2}

    filter{|x| x%2 == 0} each{|x| print(x)}
  83. Powered by Rabbit 2.1.8   map=each+emit

  84. Powered by Rabbit 2.1.8   def map(func) { each{|x| emit

    func(x)} }
  85. Powered by Rabbit 2.1.8   Filters reduce{|x,y| x*y} reduce_by_key{|x,y| x*y}

    count min/max
  86. Powered by Rabbit 2.1.8   time

  87. Powered by Rabbit 2.1.8   now() time("2016-05-28T10:30 +0830") time(2016,5,28,10,30)

  88. Powered by Rabbit 2.1.8   任意のタイムゾーンで生成・表示

  89. Powered by Rabbit 2.1.8   csv

  90. Powered by Rabbit 2.1.8   csv()

  91. Powered by Rabbit 2.1.8   stat/math/sort

  92. Powered by Rabbit 2.1.8   sum() average() stdev() variance() correl()

    sample()
  93. Powered by Rabbit 2.1.8   sort sort{|x,y| x.cmp(y)} sort_by{|x| x(2)}

    median median{|x| x(2)}
  94. Powered by Rabbit 2.1.8   今後の展開

  95. Powered by Rabbit 2.1.8   総称関数

  96. Powered by Rabbit 2.1.8   パターンマッチング

  97. Powered by Rabbit 2.1.8   キーワード引数

  98. Powered by Rabbit 2.1.8   なにができるの?

  99. Powered by Rabbit 2.1.8   CSV処理

  100. Powered by Rabbit 2.1.8   統計(っぽい)処理

  101. Powered by Rabbit 2.1.8   シェルスクリプト(っぽい)処理

  102. Powered by Rabbit 2.1.8   データ変換

  103. Powered by Rabbit 2.1.8   おもちゃレベルのEmbulk

  104. Powered by Rabbit 2.1.8   Web? Maybe

  105. Powered by Rabbit 2.1.8   Game? Maybe

  106. Powered by Rabbit 2.1.8   ワークフローエンジン?

  107. Powered by Rabbit 2.1.8   今後も成長

  108. Powered by Rabbit 2.1.8   楽しい!

  109. Powered by Rabbit 2.1.8   自作言語の世界

  110. Powered by Rabbit 2.1.8   Thank you