Let me welcome you with some Scala code:
object Hello extends App {
println("Hello!")
}
And now the same, but with standard Markdown formatting:
object Hello extends App {
package frp | |
import rx._ | |
import rx.ops._ | |
object Demo extends App { | |
case class Val[+T](value: T, reduced: Boolean = false) { | |
def toOpt = if (reduced) Some(value) else None | |
} |
object StackTraceHelper | |
{ | |
def retainWithBorder [T] (items: Seq[T], | |
valuable: (T => Boolean)): Seq[T] = | |
{ | |
if (items.size < 3) return items | |
val retained = for | |
{ |
Let me welcome you with some Scala code:
object Hello extends App {
println("Hello!")
}
And now the same, but with standard Markdown formatting:
object Hello extends App {
case class Reader[Conf, Res](obtainResult: Conf => Res) { | |
def map[NewRes](transform: Res => NewRes) = | |
Reader { | |
(config: Conf) => | |
transform(this obtainResult config) | |
} | |
def flatMap[NewRes](createReader: Res => Reader[Conf, NewRes]) = | |
Reader { |
index 2cb9192..42bea4b 100644 | |
--- a/src/main/scala/net/lag/smile/MemcacheConnection.scala | |
+++ b/src/main/scala/net/lag/smile/MemcacheConnection.scala | |
@@ -119,7 +119,7 @@ class MemcacheConnection(val hostname: String, val port: Int, val weight: Int) { | |
@throws(classOf[MemcacheServerException]) | |
def store(query: String, key: String, value: Array[Byte], flags: Int, expiry: Int): Boolean = { | |
- serverActor !? Store(query, key, flags, expiry, value) match { | |
+ serverActor.!?(20 * 1000l, Store(query, key, flags, expiry, value)).getOrElse(Error("Unable to send message to server due to a temporary local problem")) match { | |
case Timeout => |
Thread 10: (state = BLOCKED) | |
- java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be imprecise) | |
- java.lang.Object.wait() @bci=2, line=485 (Interpreted frame) | |
- scala.actors.Actor$class.suspendActor(scala.actors.Actor) @bci=21, line=731 (Interpreted frame) | |
- scala.actors.Actor$class.receive(scala.actors.Actor, scala.PartialFunction) @bci=109, line=431 (Interpreted frame) | |
- my.innocent.actor.that.simply.wants.to.send.message.via.Kestrel.receive(scala.PartialFunction) @bci=2, line=18 (Interpreted frame) | |
- scala.actors.Channel.receive(scala.PartialFunction) @bci=16, line=91 (Interpreted frame) | |
- scala.actors.Actor$class.$bang$qmark(scala.actors.Actor, java.lang.Object) @bci=29, line=599 (Interpreted frame) | |
- scala.actors.Actor$$anon$1.$bang$qmark(java.lang.Object) @bci=2, line=94 (Interpreted frame) | |
- net.lag.smile.MemcacheConnection.store(java.lang.String, java.lang.String, byte[], int, int) @bci=19, line=115 (Interpreted frame) |
package wrasse3 | |
import scala.actors.Actor._ | |
import System.{currentTimeMillis => now} | |
import actors.{Actor, TIMEOUT} | |
class GateActor[R](sendRequest: => R, | |
errorResponse: R, | |
maxErrors: Int, | |
closePeriod: Int) extends Actor { |