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
package controllers | |
import play.api._ | |
import play.api.mvc._ | |
import shapeless.Nat | |
import shapeless.ops.nat.ToInt | |
class Bar[L<:Nat] | |
object Application extends Controller { |
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
Active Learning | |
Applications | |
Approximate Inference | |
Bioinformatics | |
Causal Inference | |
Clustering | |
Cost-Sensitive Learning | |
Data Streams | |
Empirical Insights into ML | |
Ensemble Methods |
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
+ def whens_s[S](cond: S => Boolean)(f: S => State[S,Any]): State[S,Unit] = for { | |
+ s <- State.get[S] | |
+ _ <- if (cond(s)) f(s) else State.state[S,Unit](()) | |
+ } yield () | |
+ |
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
case class Action[S](when: (S) => Boolean, | |
then: (S) => Either[String, S], | |
name: String = "") | |
{ | |
def apply(state: S): Either[String, S] = | |
if (when(state)) then(state) | |
else Left(s"The system could not execute the action '$name'.") | |
} | |
case class Goal[S](actionSet: List[Action[S]], name: String = "") { |
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 scalaz.\/ | |
import scalaz.\/._ | |
import scalaz.syntax.std.boolean._ | |
case class Action[S](when: S => Boolean, then: S => String \/ S, name: String = "") { | |
def apply(state: S): String \/ S = | |
when(state) ? then(state) | left(s"The system could not execute the action '$name'.") | |
} |
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
object Foo { | |
def given[A,B,C,S](aa: S => Stream[A], | |
bb: S => Stream[B], | |
cc: S => Stream[C]) = new { | |
def thereExists(f: (A,B,C)=>Boolean)(s: S): Boolean = { | |
val cross = for { | |
a <- aa(s) | |
b <- bb(s) | |
c <- cc(s) |
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
def forAll[A, B, S](generatorA: (S) => List[A], generatorB: (S) => List[B], predicate: (A, B) => Boolean): (S) => Boolean = { | |
(state) => | |
(for { | |
a <- generatorA(state) | |
b <- generatorB(state) | |
} yield (a, b)).forall(predicate.tupled) | |
} | |
def thereExists[A, B, C, S](generatorA: (S) => List[A], generatorB: (S) => List[B], generatorC: (S) => List[C], predicate: (A, B, C) => Boolean): (S) => Boolean = { | |
(state) => |
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
/* The Scalaz version would look something like this: */ | |
import scalaz.Lens.lensg | |
val bandNameL = lensg[Band, String](b => n => b.copy(name = n), _.name) | |
val guitarTuningL = lensg[Guitar, String](g => t => g.copy(tuning = t), _.tuning) | |
// KeyedLens #1: Here Person is a key. | |
def guitarL(p: Person) = lensg[Band, Guitar]( | |
b => newValue => b.copy(members = b.members + (p -> newValue)), | |
b => b.members(p)) |
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
/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/java -Didea.launcher.port=7534 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13.app/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/javafx-doclet.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/htmlconverter.jar:/Li |
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
object ET { | |
import scalaz.Lens | |
case class Foo[A](a: A, i: Int) | |
object Foo { | |
def a[A]: Lens[Foo[A],A] = Lens.lensg(x => y => x.copy(a=y), _.a) | |
def i1[A]: Lens[Foo[A],Int] = Lens.lensg(x => y => x.copy(i=y), _.i) | |
def i2: Lens[Foo[A] forSome {type A},Int] = Lens.lensg(x => y => x.copy(i=y), _.i) | |
def i3: Lens[Foo[_],Int] = Lens.lensg(x => y => x.copy(i=y), _.i) | |
} |