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
import java.util.function.Function; | |
import java.util.function.BiFunction; | |
import java.util.Scanner; | |
abstract class TerminalOperation<A> { | |
// this ensures that there are no subclasses of TerminalOperation | |
// outside of this class | |
private TerminalOperation() { | |
} |
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
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
import Control.Monad.IO.Class | |
import Control.Monad.Trans.Class | |
import Prelude hiding (log) | |
-------------------------------------------------------------------------------- | |
-- The API for cloud files. | |
class Monad m => MonadCloud m where | |
saveFile :: Path -> Bytes -> m () |
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
import rx.lang.scala.Observable | |
import rx.lang.scala.subjects.BehaviorSubject | |
object LookAndSay { | |
def main(args: Array[String]) { | |
val pipe = BehaviorSubject(Observable.just('1')) | |
pipe.map(next).foreach(x => { | |
x.doOnCompleted(println()).foreach(print(_)) | |
pipe.onNext(x) |
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 waterpouring { | |
type State = (Int, Int) | |
val initState = (0, 0) | |
val target = 6 | |
val limit = (4, 9) | |
abstract class Action { | |
def apply(current:State):State | |
} |