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

Clojure in General #TechLunch

Clojure in General #TechLunch

2012/01/18(水) @ Livesense TechLunch
発表者:佐藤 洋輔

E60aa4f80303f3f386898546ddb3686a?s=128

Livesense Inc.
PRO

April 23, 2014
Tweet

Transcript

  1. Clojure in General Stairway to a L!p hacker

  2. Table of Contents 1ɾClojureͱ͸ 2ɾ͢΂ͯ͸ γʔέϯεͰ͋Δ 3ɾίʔυͱσʔλ 4ɾकഁ཭

  3. 1ɾClojureͱ͸

  4. ؔ਺ܕݴޠ ; => ·ͨྲྀߦΓ΋ͷͰ͢ Lispํݴ ; => ׅހύϥμΠε(^o^) Rich Hickey

    ; => ಡΈํ͕ɻɻɻ 2007೥σϏϡʔ ; => nil ཧ૝ΑΓ΋࣮༻ੑॏࢹ ; => Haskell
  5. ༷ʑͳݴޠ࣮૷ JVMݴޠͱͯ͠༗໊͕ͩɺ࣮૷ඇґଘ Clojure ; => JVM࣮૷ ClojureCLR ; => .Net࣮૷

    ClojureScript ; => JavaScript࣮૷
  6. ༷ʑͳϑϨʔϜϫʔΫ Noir ; => WebΞϓϦέʔγϣϯϑϨʔϜϫʔΫ Korma ; => RDBMSʢ౰વO/RͰͳ͍ʣ SeeSaw

    ; => Swing Cascalog ; => Hadoop 2007೥ʹͰ͖ͨݴޠͱ͸ࢥ͑ͳ͍ॆ࣮ͿΓ
  7. LispͷྗΛࣦΘͳ͍ ݶΓʹ͓͍ͯ ग़དྷΔ͚ͩLispΒ͘͠ͳ͘ car, cdr ; => ͕͢͞ʹաڈϋʔυґଘ͸ɻɻɻ ׅހলུ ;

    => ΄Μͷͪΐͬͱ(^_^;) ۭϦετධՁ ; => Clojureͷํ͕ݫີ
  8. 2ɾ͢΂ͯ͸ γʔέϯεͰ͋Δ

  9. ͢΂͕ͯϦετͷLispͱҧ͍ɺClojure ͷ͢΂ͯ͸γʔέϯε γʔέϯε͸΄ͱΜͲͷू߹ܕΛந৅ Խͨ͠΋ͷ first, rest, consΛ࣮૷

  10. LispͷϦετ͸ίϯεηϧ͕ͩɺ ClojureͷϦετ͸࣮૷ඇґଘ ( peek '(1 2 3)) ; => 1

    ( peek [1 2 3]) ; => 3
  11. Ͳͷ͘Β͍͢΂͔ͯ

  12. ͢΂͕ͯ࿈૝഑ྻͳ JavaScript͞Μͷ৔߹

  13. ͢΂͕ͯγʔέϯεͳ Clojure͞Μͷ৔߹

  14. ; => ͜ͷਗ਼ʑ͍͠·Ͱͷ ͢΂ͯͬ΀Γ͕ Կͷ໾ʹཱͭͷ͔ɻɻɻ

  15. 3ɾίʔυͱσʔλ

  16. ؔ਺ɺϚΫϩɺಛघܗࣜɺԋࢉࢠɺ஋ ͦͷ͢΂͕ͯ΄ͱΜͲಉ͡Α͏ʹѻ͑ Δ μοΫλΠϓͷڀۃܥ ίʔυͱσʔλͷڥք͢Βᐆດ

  17. 4ɾकഁ཭

  18. ClojureʢLispʣͷจ๏͸Clean Code తʹ͍͏ͱNGͳॻ͖ํΛॿ௕͍ͯ͠Δ ௕͍Ҿ਺Ϧετ Ҿ਺ͷॱংʹΑΔڧ͍ҙຯ෇͚

  19. ; => جຊΛकΔ͚ͩͰ͸ ಘΒΕͳ͍ྗ͕ ͋Δͱ͍͏͜ͱ

  20. ߏจ͕؆ૉͳͨΊϝλϓϩάϥϛϯά͕ ༰қ ԋࢉࢠ͸໪࿦ɺ΄΅ͳΜͰ΋࠶ఆ͕ٛͰ ͖Δ ҙຯෆ໌ʹͳΓ͗͢ͳ͍Α͏ϦʔμʔϚΫ ϩ͸ॻ׵Ͱ͖ͳ͍ʢLispͱରরతʣ ෳࡶͳߏจΛ౶ҥ͢ΔRubyɺ؆ܿͳߏจ Λ֦ு͢ΔLisp଒

  21. ; => ݴޠͦͷ΋ͷΛ ഁյ͢ΔΑ͏ͳڧ͍ྗʹ͸ େ͖ͳ੹೚͕൐͏

  22. ΦϒδΣΫτࢦ޲ݴޠ͸ɺෳࡶ͗͢ΔߏจΛε Ϛʔτʹݟ͔͚ͤΔͨΊͷ࣮૷ʹखؒΛऔΒΕ ա͍͗ͯΔ ͦͯͦ͠ͷ࣮૷ʹΑΓ·ͨҰ૚ίʔυͷෳࡶ͞ ͕૿͍ͯ͠Δ ݱࡏ͸CIπʔϧͳͲͰͦͷෳࡶ͔͞Βੜ·ΕΔ ϛεΛٵऩ͢Δํ޲ʹಈ͍͍ͯΔ Ͱ΋ͦͷπΪϋΪ͞͸ɺ͔ͭͯίʔυͷγϯϓ ϧ͞ΛઃఆϑΝΠϧͰ୲อ͍ͯͨ࣌͠୅Λኲኵ ͱͤ͞Δ

  23. ; => ͦΖͦΖॅΈ׳Εͨ ৔ॴ͔Β཭ΕΔͷʹ ͍͍࣌ظ͔΋͠Εͳ͍

  24. ͓·͚: ຤ඌݺग़࠷దԽ ؔ਺຤ඌͰͷؔ਺ݺग़͸ɺݺग़ݩͷϦιʔεΛ DEALLOCATE͢Δ͜ͱͰ࠷దԽͰ͖Δ JVM͕ະରԠ Scala͸ಠࣗʹ຤ඌ࠶ؼ࠷దԽʢTCOʣΛ࣮૷ Clojure͸recur...loopಛघܗࣜΛ༻ҙ

  25. ͳͥClojure͸ࣗಈͰ TCO͠ͳ͍͔ ؤுͬͯ΋຤ඌ“࠶ؼ”࠷దԽ͔͠Ͱ͖ͳ͍͔Β ໌ࣔతͳߏจΛ༻ҙ͢Δ͜ͱͰ࠷దԽνΣοΫ Ͱ͖Δ͔ΒʢScala΋2.8͔ΒΞϊςʔγϣϯͰ ޙଓʣ ࠶ؼઌΛؔ਺಺ͰॊೈʹઃఆͰ͖Δ͔Βʢ࠶ؼ ͷ୯Ґ͕খ͍͞৔߹ɺผؔ਺ఆٛ͸μϧ͍ʣ

  26. ࣍ճ༧ࠂ

  27. Git "#$buted Version Control Sy#em

  28. Ͱ΋ͦͷޙ͸ ClojureScript ClojureϑϨʔϜϫʔΫ ʹ໭Δ༧ఆ

  29. Bye!!!