This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~01001~^~Y~^~some text1~^~~^1.38 | |
~01002~^~N~^~some text2~^~~^2.38 | |
~01003~^~Y~^~some text3~^~full test~^3.38 | |
~01004~^~N~^~some text4~^~~^4.38 | |
~01005~^~Y~^~some text5~^~dddd~^5.38 | |
~01006~^~N~^~some text6~^~~^6.38 | |
~01007~^~Y~^~some text7~^~~^7.38 | |
~01008~^~Y~^~some text8~^~~^8.38 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lines.foreach(line ⇒ line match { | |
case RegEx(id, yesNo, name, optional, amount) ⇒ println(Line(id.toLong, | |
booleanFromString(yesNo).get, | |
name, optionString(optional), amount.toDouble)) | |
case _ ⇒ println("Something Wrong!") | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.papasofokli | |
import scala.util.parsing.combinator.JavaTokenParsers | |
/** | |
* <b-expression>::= <b-term> [<orop> <b-term>]* | |
* <b-term> ::= <not-factor> [AND <not-factor>]* | |
* <not-factor> ::= [NOT] <b-factor> | |
* <b-factor> ::= <b-literal> | <b-variable> | (<b-expression>) | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private lazy val b_not_factor: Parser[Boolean] = opt("not") ~ b_factor ^^ (x ⇒ x match { case Some(v) ~ f ⇒ !f; case None ~ f ⇒ f }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
opt("not") ~ b_factor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(x ⇒ x match { case Some(v) ~ f ⇒ !f; case None ~ f ⇒ f }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example | |
import scala.concurrent.{ Future, Promise, future, promise } | |
import scala.concurrent.ExecutionContext.Implicits.global | |
class FuturesAndPromises | |
object FuturesAndPromises { | |
def main(args: Array[String]) { | |
futureSample |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NonVariantType[T] | |
{ | |
// some functions and fields | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val string: Any = "sofoklis" // String is a proper subtype of any | |
val nonVariantType1: NonVariantType[String] = new NonVariantType[String] // Allowed | |
val nonVariantType2: NonVariantType[Any] = new NonVariantType[String] // Compile error | |
val nonVariantType3: NonVariantType[String] = new NonVariantType[Any] // Compile error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CovariantType[+T] { | |
// some functions and fields | |
} |