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

My Personal Report of Scala Kansai 2016

Pishen Tsai
November 01, 2016
160

My Personal Report of Scala Kansai 2016

Pishen Tsai

November 01, 2016
Tweet

Transcript

  1. • Scala入門/基礎的な文法 - 5場 • 開発環境・ビルドツール - 1場 • Webアプリケーションフレームワーク

    - 2場 • 関数型プログラミング - 2場 • 業務への導入・活用事例 - 5場 • データサイエンス - 2場 • Scala.js - 0場 (去年有) • リアクティブシステム - 5場 • コンパイラ・JVM - 1場
  2. #1 麻植 泰輔 Taisuke Oe - BONX Inc. - ScalaMatsuri

    總召 - 業餘 Scala 教師 - DL4J 成員
  3. #1

  4. #1

  5. #1

  6. #1

  7. #1

  8. #1

  9. #1

  10. #1

  11. #1

  12. #1

  13. #2

  14. #2 竹添 直樹 Naoki Takezoe - BizReach - GitBucket -

    ScalaWarrior - Scala逆引きレシピ
  15. #2

  16. #2

  17. #2

  18. #2

  19. #2

  20. #2

  21. #3

  22. #4

  23. #4

  24. #4

  25. #4

  26. #4

  27. #4

  28. #4

  29. #4

  30. #4

  31. ZonedDateTime.now() + 2.months ZonedDateTime.now() < ZonedDateTime.now() + 1.month ZonedDateTime.now() to

    (ZonedDateTime.now() + 1.day) (ZonedDateTime.now() to (ZonedDateTime.now() + 1.second)).millis 2.hours + 45.minutes + 10.seconds // returns PT2H45M10S (2.hours + 45.minutes + 10.seconds).millis 2.months + 3.days // returns P2M3D LocalDate.now() to (LocalDate.now() + 7.days) by 2.days #4
  32. #4

  33. #5

  34. #5

  35. #5

  36. #5

  37. #5

  38. #6

  39. #6

  40. #6

  41. #6

  42. #6

  43. #6

  44. #6

  45. #7

  46. #7 case class B(b: Int) case class A(a: Int, b:

    B) val a1 = A(1, B(2)) val a2 = a1.copy(a = 10) val a3 = a1.copy(b = a1.b.copy(b = 20))
  47. #7 a.copy( b = a.b.copy( c = a.b.c.copy( d =

    a.b.c.d.copy( e = a.b.c.d.e.copy( f = 87 ) ) ) ) ) The copy method hell.
  48. class Lens[S, A]( getter: S => A, setter: S =>

    A => S ) { def get(s: S) = getter(s) def set(s: S, a: A) = setter(s)(a) def modify(s: S, f: A => A) = set(s, f(get(s))) } #7
  49. case class User(id: Int, name: String) val _id = new

    Lens[User, Int]( _.id, user => newId => user.copy(id = newId) ) val u1 = User(100, "Pishen") val u2 = _id.set(u1, 101) #7
  50. class Lens[S, A](getter: S => A, setter: S => A

    => S) { def get(s: S) = getter(s) def set(s: S, a: A) = setter(s)(a) def modify(s: S, f: A => A) = set(s, f(get(s))) def ^|->[B](other: Lens[A, B]): Lens[S, B] = new Lens( s => other.get(this.get(s)), s => b => this.set(s, other.set(this.get(s), b)) ) } #7
  51. #7 case class Msg(user: User, body: String) val msg =

    Msg(User(100,"Pishen"), "Hi") msg.copy( user = msg.user.copy( id = 101 ) ) (_user ^|-> _id).set(msg, 101)
  52. #8

  53. #8

  54. #8

  55. #8