This file contains 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
object Math extends App { | |
case class ResultSet(n1: Int, n2: Int) { | |
lazy val result = n1 * n2 | |
override def equals(obj: Any): Boolean = obj match { | |
case r: ResultSet => (n1 == r.n1 && n2 == r.n2) || (n1 == r.n2 && n2 == r.n1) | |
case _ => false | |
} |
This file contains 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
object Operator { | |
type op = PartialFunction[Char, (Int, Int) => Int] | |
val plus: op = { | |
case '+' => _ + _ | |
} | |
val minus: op = { | |
case '-' => _ - _ | |
} | |
val multi: op = { |
This file contains 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
//Created By Ilan Godik | |
package elementaryDataStructures | |
import org.scalatest.{GivenWhenThen, Matchers, FlatSpec} | |
class DequeTest extends FlatSpec with Matchers with GivenWhenThen { | |
"A Deque" should "throw an NullPointerException when calling addFirst with null" in { | |
intercept[NullPointerException] { | |
val model = new Deque[String] | |
model.addFirst(null) |
This file contains 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 ModelCombinator extends JavaTokenParsers { | |
def mod: Parser[Any] = "model" ~ ident ^^ { | |
case x => println("Hoping for string value of ident " + x.toString()) | |
} | |
def model: Parser[Any] = "model" ~ ident ~ "{" ~ rep(member) ~ "}" | |
def member: Parser[Any] = ident ~ ":" ~ ident ~ "@" ~ ("eager" | "lazy") ~ relation.? ~ ";" | |
This file contains 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
trait Functor { | |
type M <: { type T } | |
def fmap[A, B](fa: M { type T = A })(f: A => B): M { type T = B } | |
} | |
implicit class EitherRightFunctor extends Functor { self => | |
type L | |
type M = Either { type A = self.L ; type T = B } //doesn't this specify a subtype of Either, rather than Either itself? | |
def fmap[A0, B0](fa: M { type A = self.L ; type B = A0 })(f: A0 => B0): Either { type A = self.L ; type B = B0 } = |
This file contains 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
trait Decorable[A, B] { | |
def decorate(obj: A, dec: B): Either[String, A] | |
} | |
object Decorator { | |
def decorate[A, B](implicit d: Decorable[A,B]) = d | |
} | |
object TagsDecorator { |
This file contains 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
Pre-Oreder: | |
root-->left-->right | |
In-Oreder: | |
left-->root-->right | |
Post-Oreder: | |
left-->right-->root | |
================================================== | |
Sorts: | |
Max-Sort: |
This file contains 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 nightra.mashovNotificator.network | |
import scala.concurrent.{ExecutionContext, Future} | |
import scalaz.effect.IO | |
import scalaz.effect.IO._ | |
import scalaz.Reader | |
import scala.util.{Success, Failure, Try} | |
case class Task[A](task: Reader[ExecutionContext, IO[Future[A]]]) { | |
def map[B](f: A => B): Task[B] = Task(Reader(implicit executor => task(executor).map(_.map(f)))) |
This file contains 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
Wanted behavior: | |
[info] Started 1 | |
[info] Started 2 | |
[info] Started 3 | |
[info] Started 4 | |
[info] Started 5 | |
[info] Finished 5 in 215 | |
[info] Finished 4 in 615 | |
[info] Finished 3 in 825 | |
[info] Finished 2 in 1109 |
This file contains 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
מה עשית? | |
[21:35:30] Ilan: ואו, הרבה | |
[21:35:36] Ilan: היו תחנות | |
[21:35:41] Ilan: תחנה 1: | |
[21:36:00] Ilan: סימולציה שאתה עובד כלשהו ויש לקוח לא מרוצה | |
[21:36:48] Ilan: אני הייתי מוכר הכרטיסים בקולנוע ובאה אחת שהזמינה 2 כרטיסים בשורה 10 ונתנו לה כרטיס בשורה 1 ובשורה 5 | |
[21:36:52 | 21:36:54 נערך] Ilan: והיא רוצה לשבת עם חברה שלה | |
[21:37:01] Ilan: ואי אפשר לתת החזר כספי | |
[21:37:23] Ilan: ואי אפשר יום אחר כי זה היום הולדת של חברה שלה | |
[21:37:50] Ilan: וניסיתי לעזור לה שאולי תשאל אנשים באולם אם אפשר להחליף |
OlderNewer