Skip to content

Instantly share code, notes, and snippets.

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 {
@aryairani
aryairani / icml-2014-subjects.txt
Created January 20, 2014 22:17
ICML 2014 subjects
Active Learning
Applications
Approximate Inference
Bioinformatics
Causal Inference
Clustering
Cost-Sensitive Learning
Data Streams
Empirical Insights into ML
Ensemble Methods
+ 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 ()
+
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 = "") {
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'.")
}
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)
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) =>
/* 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))
/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
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)
}