Skip to content

Commit

Permalink
Merge pull request #68 from laverboy/patch-1
Browse files Browse the repository at this point in the history
few text tweaks
  • Loading branch information
juanpedromoreno authored Dec 26, 2016
2 parents e9d49c8 + 6ff6b3f commit ea8f903
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/stdlib/Classes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ object Classes extends FlatSpec with Matchers with org.scalaexercises.definition
* }
* }}}
*
* The program defines an executable application `Classes` in form of a top-level singleton object with a `main` method. The `main` method creates a new `Point` and stores it in value `pt`.
* The program defines an executable application `Classes` in the form of a top-level singleton object with a `main` method. The `main` method creates a new `Point` and stores it in value `pt`.
*
* This also demonstrates the use of a value parameters in ClassWithValParameter(val name: String), which automatically creates an internal property (val name: String) in the class.
* This also demonstrates the use of value parameters in ClassWithValParameter(val name: String), which automatically creates an internal property (val name: String) in the class.
*
*/
def classWithValParameterClasses(res0: String) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/scala/stdlib/HigherOrderFunctions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object HigherOrderFunctions extends FlatSpec with Matchers with org.scalaexercis

/** Meet lambda. Scala provides a relatively lightweight syntax for defining anonymous functions. Anonymous functions in source code are called function literals and at run time, function literals are instantiated into objects called function values.
*
* Scala supports first-class functions, which means you can express functions in function literal syntax, i.e.,` (x: Int) => x + 1`, and that functions can be represented by objects, which are called function values.
* Scala supports first-class functions, which means you can express functions in function literal syntax, i.e.,` (x: Int) => x + 1`, and those functions can be represented by objects, which are called function values.
*/
def meetLambdaHigherOrderFunctions(res0: Int, res1: Int, res2: Int, res3: Int, res4: Int, res5: Int) {
def lambda = { x: Int x + 1 }
Expand Down Expand Up @@ -68,7 +68,7 @@ object HigherOrderFunctions extends FlatSpec with Matchers with org.scalaexercis
result2 should be(res1)
}

/** We can take that closure and throw into a method and it will still hold the environment
/** We can take that closure and throw it into a method and it will still hold the environment
*/
def holdEnvironmentHigherOrderFunctions(res0: Int, res1: Int) {
def summation(x: Int, y: Int Int) = y(x)
Expand Down Expand Up @@ -113,15 +113,15 @@ object HigherOrderFunctions extends FlatSpec with Matchers with org.scalaexercis
fiveAdder(5) should be(res2)
}

/** `isInstanceOf` is the same as `instanceof` in java, but in this case the parameter types can be *blanked out* using existential types with a single underline, since parameter type are unknown at runtime.
/** `isInstanceOf` is the same as `instanceof` in java, but in this case the parameter types can be *blanked out* using existential types with a single underline, since parameter types are unknown at runtime.
*/
def isInstanceOfMethodHigherOrderFunctions(res0: Boolean) {
def addWithSyntaxSugar(x: Int) = (y: Int) x + y

addWithSyntaxSugar(1).isInstanceOf[Function1[_, _]] should be(res0)
}

/** Function taking another function as parameter. Helps in composing functions.
/** Function taking another function as a parameter. Helps in composing functions.
*
* Hint: a map method applies the function to each element of a list
*/
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/stdlib/Options.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ object Options extends FlatSpec with Matchers with org.scalaexercises.definition
/** An alternative for pattern matching is performing collection style operations.
* This is possible because an option could be looked at as a collection with either one or zero elements.
*
* One of these operations is `map`. this operation allows to map the inner value to a different type while preserving the option
* One of these operations is `map`. This operation allows us to map the inner value to a different type while preserving the option
*/
def mapOptions(res0: Option[Double], res1: Option[Double]) {
val number: Option[Int] = Some(3)
Expand All @@ -88,7 +88,7 @@ object Options extends FlatSpec with Matchers with org.scalaexercises.definition
/** Note that the type of result1 is now Option[Double], thanks to the scala type inference. */
}

/** Another operation is `fold`. this operation will extract the value from the option, or provide a default if the value is `None`
/** Another operation is `fold`. This operation will extract the value from the option, or provide a default if the value is `None`
*/
def foldOptions(res0: Int, res1: Int) {
val number: Option[Int] = Some(3)
Expand Down

0 comments on commit ea8f903

Please sign in to comment.