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
/// <summary> | |
/// Attempt to process the RabbitMQ message for the subscriber notification | |
/// </summary> | |
/// <param name="message"></param> | |
/// <param name="retryCount"></param> | |
/// <returns></returns> | |
private IoEither<Failure, Unit> ProcessMessage(IConsumeContext<ProcessSubscriberNotification> message, int retryCount) | |
{ | |
Func<IConsumeContext<ProcessSubscriberNotification>, string, int, IoEither<Failure, Unit>> delayMessageProcessing = (m, log, delay) => | |
from _0 in Logger.DebugU($"STI Subscriber Notification Handler: {log}. Will retry after a delay of {delay} milliseconds.").ToIoEither<Failure, Unit>() |
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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace Stack | |
{ | |
class Program | |
{ |
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 Program { | |
def main(args: Array[String]): Unit = { | |
var fib: BigInt => BigInt = null | |
fib = n => { | |
n match { | |
case x if x <= 2 => 1 | |
case x => fib(x - 1) + fib(x - 2) | |
} |
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
//module M1 | |
object M1 { | |
//Next two imports are like importing Parsec | |
import scala.util.parsing.combinator.{Parsers,RegexParsers} | |
import scala.util.parsing.input._ | |
//Scalas version requires a bit more noise | |
object LispParser extends Parsers { | |
//Have to tell it that we want to parse characters |
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
//In order to use the type paramter A, you must define it right after the method name. | |
//Something like... | |
//def pack[A](...) | |
def pack(input: List[A]): List[List[A]] = { | |
//This seems to be a perfect case for pattern matching? Why not use... | |
// input match { | |
// case Nil => Nil | |
// case h :: t => ... | |
// } | |
if(input == Nil) { |
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
// result is never used, can this line be removed? | |
val result = calculate(input) | |
update(input) | |
save(input.child) | |
foo() | |
// can the above four lines be re-arranged in a different order? |
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
sealed trait Command | |
case object Bid extends Command | |
case object Quit extends Command | |
case object Unrecognized extends Command | |
sealed trait Result | |
case object Won extends Result | |
case object Lost extends Result |