Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Exercises/ch3-ExpressionsAndConditionals.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ First, here's the if..else block (specifically an if..else-if..else block).
scala> val amount = 2.143
amount: Double = 2.143

scala> if (amount > 0) "greater" else if (amount < 0) "lesser" else "same"
scala> if (amount > 0) "greater" else if (amount < 0) "less" else "same"
res0: String = greater
-------------------------------------------------------------------------------

Expand All @@ -40,7 +40,7 @@ Second, the match expression that achieves the same purpose.
-------------------------------------------------------------------------------
scala> amount match {
| case x if x > 0 => "greater"
| case x if x < 0 => "lesser"
| case x if x < 0 => "less"
| case x => "same"
| }
res1: String = greater
Expand Down
5 changes: 3 additions & 2 deletions Exercises/ch5-FirstClassFunctions.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ res3: Int = -1002398428
scala> val t = (nextInt, nextInt, nextInt)
t: (Int, Int, Int) = (913142586,1268532435,94040930)

scala> pickOne(t, (x, y) => x)
scala> pickOne(t, (x, y) => y)
res4: Int = 913142586
-------------------------------------------------------------------------------

Expand Down Expand Up @@ -139,6 +139,7 @@ Here's an example of invoking the original function with a specific type and sep

[source,scala]
-------------------------------------------------------------------------------
scala> def fzero[A](x: A)(f: A ⇒ Unit): A = { f(x); x }
scala> fzero[Boolean](false) { b => println(s"b was $b") }
b was false
res1: Boolean = false
Expand Down Expand Up @@ -175,7 +176,7 @@ Indeed, using a wildcard to assign a function would help make "sq" into a functi
scala> val sq = square _
sq: Double => Double = <function1>

scala> sq1(4.0)
scala> sq(4.0)
res0: Double = 16.0

scala> val sq: Double => Double = square
Expand Down
2 changes: 1 addition & 1 deletion Exercises/ch6-CommonCollections.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Again, let's start with a short and simple implementation that takes advantage o

[source,scala]
-------------------------------------------------------------------------------
scala> def longest(l: List[String]): String = names.sortBy(0 - _.size).head
scala> def longest(l: List[String]): String = l.sortBy(0 - _.size).head
longest: (l: List[String])String

scala> val names = List("Harry", "Hermione", "Ron", "Snape")
Expand Down
4 changes: 2 additions & 2 deletions Exercises/ch7-MoreCollections.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Here's a tail-recursive implementation, including the "tailrec" annotation so th
[source,scala]
-------------------------------------------------------------------------------
scala> @annotation.tailrec
| def fibAdd(l: List[Int], count: Int): List[Int] = {
| def fibAdd2(l: List[Int], count: Int): List[Int] = {
| if (count < 1) l
| else {
| val k = l :+ l.takeRight(2).sum
Expand Down Expand Up @@ -759,7 +759,7 @@ Here's an example of reporting the commits for the scala, akka and scalaz projec

[source]
-------------------------------------------------------------------------------
> ./GithubCommits.scala scala/scala/2.11.x akka/akka/master scalaz/scalaz/series%2f7.2.x
> ./GithubCommits.scala scala/scala/2.12.x akka/akka/master scalaz/scalaz/series%2f7.2.x
[info] Set current project to root-4b6293a0de6b4c2b38c4 (in build file:/Users/jason/.sbt/boot/4b6293a0de6b4c2b38c4/)
Reporting for 3 repositories: (scala,scala,2.11.x) & (akka,akka,master) & (scalaz,scalaz,series%2f7.2.x)
Github activity for scala, akka, scalaz repos
Expand Down
20 changes: 10 additions & 10 deletions Exercises/ch9-ObjectsCaseClassesAndTraits.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The new "HtmlUtils.scala" file should be located in "src/main/scala", the root d
-------------------------------------------------------------------------------
import org.scalatest._

class HtmlUtilsSpec extends FlatSpec with ShouldMatchers {
class HtmlUtilsSpec extends FlatSpec with Matchers {

"The Html Utils object" should "remove single elements" in {
HtmlUtils.removeMarkup("<br/>") should equal("")
Expand All @@ -36,7 +36,7 @@ class HtmlUtilsSpec extends FlatSpec with ShouldMatchers {
}
-------------------------------------------------------------------------------

We're only using the +FlatSpec+ and +ShouldMatchers+ types from this package, but will import everything so we can easily add additional test utilities in the future (such as "OptionValues", a favorite of mine). The class +FlatSpec+ is one of several different test types you can choose from, modeled after Ruby's *RSpec*. +ShouldMatchers+ adds the +should+ and +be+ operators to your test, creating a domain-specific language that can help make your tests more readable.
We're only using the +FlatSpec+ and +Matchers+ types from this package, but will import everything so we can easily add additional test utilities in the future (such as "OptionValues", a favorite of mine). The class +FlatSpec+ is one of several different test types you can choose from, modeled after Ruby's *RSpec*. +Matchers+ adds the +should+ and +be+ operators to your test, creating a domain-specific language that can help make your tests more readable.

The first test starts off a bit differently from the other tests. With the +FlatSpec+, the first test in a file should start with a textual description of what you are testing in this file. Later tests will use the +it+ keyword to refer to this description. This helps to create highly readable test reports.

Expand Down Expand Up @@ -83,7 +83,7 @@ Here is its test class with two new tests, one to verify that multi-line element
-------------------------------------------------------------------------------
import org.scalatest._

class HtmlUtilsSpec extends FlatSpec with ShouldMatchers {
class HtmlUtilsSpec extends FlatSpec with Matchers {

"The Html Utils object" should "remove single elements" in {
HtmlUtils.removeMarkup("<br/>") should equal("")
Expand Down Expand Up @@ -179,7 +179,7 @@ b) A good test should indicate a specific feature, whether functional or non-fun
-------------------------------------------------------------------------------
import org.scalatest._

class SafeStringUtilsSpec extends FlatSpec with ShouldMatchers {
class SafeStringUtilsSpec extends FlatSpec with Matchers {

"The Safe String Utils object" should "trim empty strings to None" in {
SafeStringUtils.trimToNone("") should be(None)
Expand Down Expand Up @@ -247,7 +247,7 @@ Here's the full test class including three new tests for the "parseToInt" functi
-------------------------------------------------------------------------------
import org.scalatest._

class SafeStringUtilsSpec extends FlatSpec with ShouldMatchers {
class SafeStringUtilsSpec extends FlatSpec with Matchers {

"The Safe String Utils object" should "trim empty strings to None" in {
SafeStringUtils.trimToNone("") should be(None)
Expand Down Expand Up @@ -347,7 +347,7 @@ Following is the final version of the test class with three new tests.
-------------------------------------------------------------------------------
import org.scalatest._

class SafeStringUtilsSpec extends FlatSpec with ShouldMatchers {
class SafeStringUtilsSpec extends FlatSpec with Matchers {

"The Safe String Utils object" should "trim empty strings to None" in {
SafeStringUtils.trimToNone("") should be(None)
Expand Down Expand Up @@ -504,7 +504,7 @@ Here's my test class, including a utility method to write the content to a new u
import java.io.File
import org.scalatest._

class MultiReplacerSpec extends FlatSpec with ShouldMatchers {
class MultiReplacerSpec extends FlatSpec with Matchers {

import MultiReplacer._

Expand Down Expand Up @@ -661,7 +661,7 @@ import java.io.{PrintWriter, File}
import org.scalatest._


class FileSummySpec extends FlatSpec with ShouldMatchers {
class FileSummySpec extends FlatSpec with Matchers {

import FileSummy._

Expand Down Expand Up @@ -945,7 +945,7 @@ trait PrintlnTesting {
}
}

class GHIssueReporterSpec extends FlatSpec with ShouldMatchers with PrintlnTesting {
class GHIssueReporterSpec extends FlatSpec with Matchers with PrintlnTesting {

import ch9.GHIssueReporter._

Expand Down Expand Up @@ -1032,7 +1032,7 @@ trait JSONSupport {
implicit val formats = DefaultFormats

def parseIssuesFromJson(json: String): List[GithubIssue] = {
val t = Try( JsonMethods.parse(json).extract[List[GithubIssue]] )
val t = scala.util.Try( JsonMethods.parse(json).extract[List[GithubIssue]] )
t getOrElse Nil
}

Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

# 러닝 스칼라

![러닝 스칼라](http://image.kyobobook.co.kr/images/book/large/791/l9791185890791.jpg)

**출판사** 제이펍
**원출판사** O’REILLY
**원서명** Learning Scala(원서 ISBN 9781449367930)
**저자명** 제이슨 스와츠
**역자명** 김정인, 강성용
**출판일** 2017년 4월 17일
**페이지** 292쪽
**ISBN** 979-11-85890-79-1 (93000)

[### 도서 소개 페이지 바로 가기 ###](http://jpub.tistory.com/677)


File renamed without changes.
Loading