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 org.apache.commons.math3.distribution.{ChiSquaredDistribution, NormalDistribution} | |
| import scala.math._ | |
| /** | |
| * Created by logicalguess on 6/22/16. | |
| */ | |
| case class ProportionInfo(attempts: Int, successes: Int) { | |
| val failures: Double = attempts - successes |
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 org.apache.spark.SparkConf; | |
| import org.apache.spark.serializer.KryoSerializer; | |
| import org.apache.spark.storage.StorageLevel; | |
| import org.apache.spark.streaming.Duration; | |
| import org.apache.spark.streaming.Durations; | |
| import org.apache.spark.streaming.api.java.JavaReceiverInputDStream; | |
| import org.apache.spark.streaming.api.java.JavaStreamingContext; | |
| import org.apache.spark.streaming.receiver.Receiver; |
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 scalaz | |
| final case class Dag[A](value: A, dependencies: IList[Dag[A]]){ | |
| def toTree(implicit A: Order[A]): DagTree[A] = | |
| DagTree(value, dependencies.map(_.toTree)) | |
| } | |
| object Dag { | |
| def single[A](a: A): Dag[A] = Dag(a, INil()) |
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 org.apache.beam.examples; | |
| import org.apache.beam.sdk.coders.Coder; | |
| import org.apache.beam.sdk.coders.SerializableCoder; | |
| import org.apache.beam.sdk.coders.StringUtf8Coder; | |
| import org.apache.beam.sdk.io.Read; | |
| import org.apache.beam.sdk.io.UnboundedSource; | |
| import org.apache.beam.sdk.options.PipelineOptions; | |
| import org.apache.beam.sdk.testing.TestPipeline; | |
| import org.apache.beam.sdk.transforms.MapElements; |
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
| val sum: (Int, Int, Int) => Int = _ + _ + _ | |
| val sumCurried: Int => Int => Int => Int = sum.curried | |
| val f: Int => Int = sum.curried(1)(2) | |
| val g: Int => Int = sum(1, 2, _: Int) | |
| println(f(3)) //6 | |
| println(g(3)) //6 |
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 fs { | |
| def comb(list: Any*): String = { | |
| list.mkString | |
| } | |
| def comb1(i: Int, s1: String, s2: String): String = i + s1 + s2 | |
| } | |
| val args = List(2, "b", "c") |
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 logicalguess | |
| import shapeless.HList._ | |
| import shapeless._ | |
| import scala.annotation.implicitNotFound | |
| import scala.language.implicitConversions | |
| import scala.reflect.ClassTag | |
| object ShapelessFunctions { |
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
| trait HListMapper[In <: HList, Out <: HList] { | |
| def apply(in: In): Out | |
| } | |
| object HListMapper { | |
| implicit def caseHNil: HListMapper[HNil, HNil] = (in: HNil) => HNil | |
| implicit def caseHList[H1, H2, T1 <: HList, T2 <: HList] | |
| ( |
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 logicalguess | |
| import shapeless.{::, HList, HNil} | |
| trait HListFolder[In <: HList, Out] { | |
| def apply(in: In): Out | |
| } | |
| object HListFolder { |
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 logicalguess.receiver | |
| import scala.reflect.ClassTag | |
| case class Call[U <: Union](pf: PartialFunction[Any, Any]) { | |
| import Call._ | |
| def union[In](f: Function[In, Any])(implicit ct: ClassTag[In]) = Call[U | In](pf.orElse(downcast(f))) |
OlderNewer