Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Making sense of Probabilistic Programming with Figaro and Pfennig | |
=== | |
SlamData tech talk 2016-09-08 | |
Building Interest | |
--- | |
- Noticed Probabilistic Graphical Models on Coursera | |
- https://www.coursera.org/learn/probabilistic-graphical-models | |
- Probabilistic Graphical Models: Principles and Techniques (Adaptive Computation and Machine Learning series) by Daphne Koller (Author), Nir Friedman (Author) |
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
let rec i j = match j with | |
| [] | [_] -> true | |
| a :: b :: c -> a = b && i(b::c);; |
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 scala.concurrent._, ExecutionContext.Implicits.global | |
import scala.async.Async.{async, await} | |
object AsyncExploration { | |
// hmm, monad transformers are cool and all but for this simple case async might be the winner | |
val α = | |
async { | |
for { |
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
S.configAll({ | |
"defaultToCurrentScreen" : true, | |
"secondsBetweenRepeat" : 0.05, | |
"checkDefaultsOnLoad" : true, | |
"focusCheckWidthMax" : 3000, | |
"windowHintsBackgroundColor" : [50, 53, 58, 0.73], | |
"windowHintsDuration" : 7, | |
"windowHintsWidth" : 65, | |
"windowHintsHeight" : 65, | |
"windowHintsFontSize" : 36 |
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 shapeless._, Poly._ | |
import scala.concurrent._, duration._, ExecutionContext.Implicits.global | |
object zoz extends Poly2 { | |
implicit def default[T, U] = at[T, T ⇒ U] { (acc, t) ⇒ t(acc) } | |
} | |
val f1 = (s: Future[String]) ⇒ s.map(1 :: _ :: HNil) | |
val f2 = (i: Future[Int :: String :: HNil]) ⇒ i.map(7L :: _) | |
val f3 = (l: Future[Long :: Int :: String :: HNil]) ⇒ l.map('z' :: _) |
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 TypeClassExample { | |
trait UnicodeOrdered[T] { | |
def ≤(i:T,j:T): Boolean | |
} | |
object UnicodeOrdered { | |
implicit object UnicodeOrderedInt extends UnicodeOrdered[Int] { | |
def ≤(i:Int,j:Int): Boolean = i <= j | |
} |
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 scalaz.Lens | |
object FocusOnScalaz { | |
// A pair of ordinary case classes ... | |
case class Address(street : String, city : String, postcode : String) | |
case class Person(name : String, age : Int, address : Address) | |
// Some lenses over Person/Address ... | |
val nameLens = Lens.lensu[Person, String]((u, newName) => u.copy(name = newName), _.name) |
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 Common { | |
trait I[A, B] { | |
def apply(a: A): B | |
} | |
def i[A, B](f: A => B): I[A, B] = new I[A,B] { | |
def apply(a: A) = f(a) | |
} | |
case class Z(boz: String) |
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 util.Random | |
object RandomGeneratorProjection { | |
// in : size of the input generator | |
// out : size of the output generator | |
def d(in: Int, out: Int): Int = { | |
assert(in > 1, "in must be greater than 1") | |
assert(out > 0, "out must be greater than 0") |
NewerOlder