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
| //реализовать закоментированные функции | |
| abstract class Set { | |
| def insert(v:Int): Set | |
| //def contains(v:Int): Boolean | |
| //def union(s:Set): Set | |
| //def remove(v:Int): Set | |
| //def filter(p: Int => Boolean):Set |
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 Rational(val num:Int, val denum:Int) { | |
| def +(that:Rational) = | |
| new Rational(num*that.denum + that.num*denum, denum*that.denum) | |
| def *(that:Rational) = | |
| new Rational(num*that.num, denum*that.denum) | |
| override def toString = num + "/" + denum | |
| //def minus(that:Rational) = { |
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
| import akka.actor._ | |
| class Misha extends Actor { | |
| override def receive = { | |
| case "Start" => { | |
| val masha = | |
| context.system.actorSelection("user/Masha") | |
| masha ! "Hello" | |
| } | |
| case "GoodBye" => println(":((") |
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
| name := "SBTTest" | |
| scalaVersion := "2.11.7" | |
| libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.3.11" | |
| libraryDependencies += "com.typesafe.akka" %% "akka-remote" % "2.3.11" |
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
| akka { | |
| actor { | |
| provider = "akka.remote.RemoteActorRefProvider" | |
| deployment { | |
| /Masha { | |
| remote = "akka.tcp://TestSystem@127.0.0.1:2553/user/Masha" | |
| } | |
| } | |
| } | |
| remote { |
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 l = List(1,2,3,4) | |
| val l2 = List(5,6,7) | |
| def length[T](l:List[T]):Int = l match { | |
| case Nil => 0 | |
| case x :: xs => 1 + length(xs) | |
| } | |
| length(l) == 4 | |
| //последний элемент списка |
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
| abstract class FootMan { | |
| def attack(n: FootMan) = { | |
| n.attackedBy(this) | |
| } | |
| def attack(n: Building) | |
| var hp:Int | |
| var damage:Int | |
| var arm:Int | |
| def attakedBy(n: FootMan) | |
| } |
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
| #include "stdafx.h" | |
| #include <functional> | |
| #include <iostream> | |
| #include <cmath> | |
| #include <vector> | |
| #include <chrono> | |
| #include <thread> | |
| #include <future> | |
| using namespace std; |
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
| #include <chrono> | |
| #include <caf/all.hpp> | |
| using namespace caf; | |
| void skynet(blocking_actor* self, actor const& parent, std::size_t num, std::size_t size, std::size_t div) { | |
| if (1 == size) | |
| { | |
| self->send(parent, std::uint64_t{ num }); | |
| } |
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
| #include "stdafx.h" | |
| #include <caf/all.hpp> | |
| #include <caf/io/all.hpp> | |
| /* | |
| CAF cluster membering (Akka-like) toy project | |
| usage | |
| CAFMembering.exe -c -p 6666 | |
| CAFMembering.exe -p 6666 |
OlderNewer