... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
| package thunder.streaming | |
| import org.apache.spark.{SparkConf, Logging} | |
| import org.apache.spark.rdd.RDD | |
| import org.apache.spark.SparkContext._ | |
| import org.apache.spark.streaming._ | |
| import org.apache.spark.streaming.dstream.DStream | |
| import org.apache.spark.mllib.clustering.KMeansModel | |
| import scala.util.Random.nextDouble |
... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
| package scalax.collection | |
| import scala.collection.mutable.ListBuffer | |
| /** FoldTransformers and the views based on them are a Scala | |
| * adaptation, and to some degree an extension, of Rich Hickey's | |
| * transducers for Clojure. They show that the concepts can be | |
| * implemented in a type-safe way, and that the implementation is | |
| * quite beautiful. | |
| */ | |
| object FoldingViews { |
| import org.scalacheck.Prop.forAll | |
| import org.scalacheck.Properties | |
| object ShakespeareSpec extends Properties("Bubble") { | |
| def spell(words: List[String], mysticNumber: Int) = | |
| mysticNumber.toString + | |
| words.mkString + "toil" + "trouble" | |
| property("bubble") = forAll { (a: List[String], b: Int) => |
| /* | |
| * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> | |
| */ | |
| import akka.actor.ActorSystem | |
| import akka.http.Http | |
| import akka.http.Http.IncomingConnection | |
| import akka.http.model.HttpEntity | |
| import akka.http.model.Multipart.FormData | |
| import akka.http.server.{ Directives, Route, RoutingSetup } |
Every application ever written can be viewed as some sort of transformation on data. Data can come from different sources, such as a network or a file or user input or the Large Hadron Collider. It can come from many sources all at once to be merged and aggregated in interesting ways, and it can be produced into many different output sinks, such as a network or files or graphical user interfaces. You might produce your output all at once, as a big data dump at the end of the world (right before your program shuts down), or you might produce it more incrementally. Every application fits into this model.
The scalaz-stream project is an attempt to make it easy to construct, test and scale programs that fit within this model (which is to say, everything). It does this by providing an abstraction around a "stream" of data, which is really just this notion of some number of data being sequentially pulled out of some unspecified data source. On top of this abstraction, sca
I'm going to start off by motivating what I'm doing here. And I want to be clear that I'm not "dissing" the existing collections implementation or anything as unproductively negative as that. It was a really good experiment, it was a huge step forward given what we knew back in 2.8, but now it's time to learn from that experiment and do better. This proposal uses what I believe are the lessons we can learn about what worked, what didn't work, and what is and isn't important about collections in Scala.
This is going to start out sounding really negative and pervasively dismissive, but bear with me! There's a point to all my ranting. I want to be really clear about my motivations for the proposal being the way that it is.
| #!/bin/sh | |
| sed -i.default "s/^zend_extension=/;zend_extension=/" /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini | |
| launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php71.plist | |
| launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php71.plist | |
| sudo brew services restart php71 | |
| echo "xdebug disabled" |
| module Main where | |
| -------------------------------------------------------------------------------- | |
| -- | This is the `Maybe` data type: | |
| -- | | |
| -- | > data Maybe a | |
| -- | > = Nothing | |
| -- | > | Just a | |
| -- | | |
| -- | `Maybe` is a sum type that can be parameterized over a given `a` type, such |
| // | |
| // @author: Mateusz Kubuszok | |
| // | |
| // requirements: ammonite 1.1.0 | |
| // usage: run `amm` and copy paste into REPL | |
| import $ivy.`org.typelevel::cats-core:1.3.1`, cats._, cats.syntax.all._ | |
| import $ivy.`org.typelevel::cats-effect:1.0.0`, cats.effect._, cats.effect.syntax._ | |
| import $ivy.`io.circe::circe-core:0.9.3`, io.circe._, io.circe.syntax._ | |
| import $ivy.`io.circe::circe-generic:0.9.3`, io.circe.generic.auto._ |