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

ScalaKitchen

 ScalaKitchen

Pishen Tsai

April 12, 2017
Tweet

More Decks by Pishen Tsai

Other Decks in Technology

Transcript

  1. • 中文版 • Start coding without installation. ◦ Java(x), REPL(x),

    sbt(x), browser(o) • Designed for beginners without native lang. • Avoid mentioning features that we seldom use. ◦ var(x), while(x), return(x)
  2. val if def block Seq infix API Map tuple ⇒

    practices String map flatMap I/O REPL install sbt main package immutable par tailrec for class object fold curry trait case class apply match implicit Option try Stream ? typeclass Monad Cats plugin Spark Play Akka ScalaJS Future JSON SQL Actor Streaming MLlib publish events books Reactive Stream
  3. Scala JavaScript write your code (1) run the program in

    your browser (3) compile by Scala.js (2)
  4. ## If Expression <img class="float-center" src="if.svg" style="height:100px"/> Scala 的 if

    expression 由上面三個區塊構成,▢ 的部份 需要是一個 `Boolean`,例如 `true`、`false`、`2 > 1`、`a == b`,或 `3 <= 4 && "a" != "b"`。 △ 與 ◯ 的部份則可以填入一個單純的 值、一個 block `{...}` (後面會提到)、或是再塞入另一個 if expression。 由於整個 if expression 最後會帶著一個值,所以我們 可以再用一個 `val` 去把整個 expression 的值接住: <iframe height="300" frameborder="0" style="width: 100%; overflow: hidden;" src="https://embed.scalafiddle.io/embed?sfid=idJKZfx/ 0"></iframe>
  5. ## If Expression <img class="float-center" src="if.svg" style="height:100px"/> Scala 的 if

    expression 由上面三個區塊構成,▢ 的部份 需要是一個 `Boolean`,例如 `true`、`false`、`2 > 1`、`a == b`,或 `3 <= 4 && "a" != "b"`。 △ 與 ◯ 的部份則可以填入一個單純的 值、一個 block `{...}` (後面會提到)、或是再塞入另一個 if expression。 由於整個 if expression 最後會帶著一個值,所以我們 可以再用一個 `val` 去把整個 expression 的值接住: ```scalaFiddle val a = if (1 < 2) 10 else 11 val b = if (a == 11) { "A" + "B" } else "C" + "D" what we want
  6. modify the code and save on ScalaFiddle modify the iframe

    id in our markdown Just modify the code in our markdown!!
  7. How to Contribute? • Pick and write a section in

    the roadmap. (please notify me first) • Suggestion for the roadmap design. • Correct the bugs in current content. • Customize ScalaFiddle for our need. ◦ Better UI on mobile view. ◦ Judging system. Show students' statuses in realtime. • Play with it / Promote it / Ask questions.