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

すごいErlang楽しく学んだ!

 すごいErlang楽しく学んだ!

表参道.rb #5の発表資料です。
http://omotesandorb.connpass.com/event/20289/

4e59ed159ecf71ef3981cfb65a62617e?s=128

Tatsuya Touma

October 16, 2015
Tweet

Transcript

  1. ͍͢͝Erlangֶָ͘͠Μͩʂ @kei_q දࢀಓ.rb #5 2015-10-01 1

  2. ͳͥErlang? 2

  3. @kei_q 1 2 • ͓࢓ࣄ: JSON APIΛ࡞ͬͯӡ༻ • Ruby/Rails •

    Swift, Objective-C 2 ࠷͓ۙ΋͠Ζ͍ͱࢥ͏΋ͷ: cloudformationͷupdate-stackͱpolicy 1 झຯͰ࢖͍ͬͯΔݴޠ: Ruby, Haskell 3
  4. ͖͔͚ͬ : RailsҎ֎ͷબ୒ࢶ JSONฦ͚ͩ͢ͳΒRailsʹͩ͜ΘΒͳͯ͘΋ྑ͍ ݴޠ΍ϑϨʔϜϫʔΫɺΤίγεςϜͷಛ௕Λཧղͯ͠ɺదࡐదॴ 4

  5. ͖͔͚ͬ : shibuya.ex#1 .ex = Elixir = ErlangVM্Ͱಈ࡞͢Δݴޠ 5

  6. ͳͥErlangΛֶ΅͏ͱࢥ͔ͬͨ • ো֐଱ੑͷߴ͞ʹ͍ͭͯ஌Γ͍ͨe1 • ElixirͷલʹErlangΛ͓͍͑ͨ͞e2 • ࣌Ӎಊ BOT αʔόʔͷهࣄΛΈͯڵຯ͕Θ͍ͨ e2

    ࢿྉΛಡΜͩΓErlangͷmoduleΛཧղ͢ΔͨΊʹErlangΛಡΊͨ΄͏͕ḿΓͦ͏ͱࢥͬͨ e1 ໷͙ͬ͢Γ຾Γ͍ͨ 6
  7. 7

  8. ࣮ࡍʹಡΜͰΈͯ 8

  9. Erlangͷಠಛͳจ๏ t1 loop(N) -> receive some_standard_message -> N + 1;

    other_message -> N-1; {get_count, Pid} -> Pid ! N, loop(N); update -> ?MODULE:loop(N); end. ͍͢͝Erlangຊͷ෇࿥AΛઌʹ໨Λ௨͢ͷ͓͢͢Ί t1 ຤ඌͷه߸Ҏ֎ʹ΋andalsoͱ͔atomͱม਺ͷ໋໊ͱ͔ൺֱԋࢉࢠͱ͔͍Ζ͍Ζಠಛ 9
  10. ຊͷ಺༰ ӈਤ͸͍͢͝Erlangຊ22.2h1ΑΓҾ༻ h1 અͷݟग़͠͸ʮErlang஍ࠈͷ࠷Լ૚ʯ 10

  11. ಡॻϩά 11

  12. ಡΈऴ͑ͯ 12

  13. ͲΕ͔ʹڵຯ͕͋Ε͹͓͢͢Ί ErlangͷҒେ͞ͷ൒෼͕ ฒߦͱ෼ࢄ ʹΑΔ΋ͷͩͱͨ͠Βɺ ΋͏൒෼͸ Τϥʔॲཧ ͷೳྗʹΑΔ΋ͷͰ͋Γɺ ͞Βʹ3ͭΊͷ൒෼Λ΋ͨΒ͢ͷ͕ OTPϑϨʔϜϫʔΫ ͳͷͰ

    ͢ɻ — ͍͢͝Erlangֶָ͘͠΅͏ʂ 14ষΑΓ3 3 ଠࣈ͸εϥΠυͰՃච 13
  14. ଞͷຊΛ͓͢͢Ί • ؔ਺ϓϩάϥϛϯάΛֶͿͨΊʹಡΉ • ʮ͍͢͝Haskellͨͷֶ͘͠΅͏!ʯ͕͓͢͢Ί • ݎ͍จମͰ΋Α͚Ε͹ʮϓϩάϥϛϯάHaskellʯ΋ 14

  15. ײ૝ 15

  16. ͍͢͝ ָ͍͠ ֶ΂Δ 16

  17. END 17

  18. εϥΠυ࡞੒ʹ࢖༻ͨ͠πʔϧ • deckset • εϥΠυ࡞੒ • atom • markdownฤू •

    googleεϓϨουγʔτ • άϥϑ࡞੒ 18