ゴールデン・ゲート・ブリッジを渡りながら考えたことのまとめ。
JSXがたくさんの人に使われるようになりました。とてもすばらしいですね。
| /** | |
| * https://github.com/json4s/json4s/issues/39 | |
| * | |
| * Validation Monad instance removed from Scalaz7. | |
| * https://github.com/scalaz/scalaz/blob/v6.0.4/core/src/main/scala/scalaz/Validation.scala#L133-L147 | |
| * | |
| * need explicitly convert to `scalaz.\/` (aka disjunction) if you want use the `Kleisli` composition | |
| */ | |
| object Main extends App { | |
| package example | |
| import scalikejdbc._, SQLInterpolation._, config._, async._ | |
| import org.fluentd.logger.scala._ | |
| import org.scalatest._, matchers._ | |
| import scala.concurrent._, duration.DurationInt, ExecutionContext.Implicits.global | |
| class SampleSpec extends FlatSpec with ShouldMatchers { | |
| case class Name(id: Long, kanji: String, kana: String) |
| (defn points [^BufferedImage image ^BufferedImage screen] | |
| (let [width (.getWidth image) | |
| height (.getHeight image) | |
| xrange (range width) | |
| yrange (range height)] | |
| (for [points | |
| (for [sx (range (- (.getWidth screen) width)) | |
| sy (range (- (.getHeight screen) height))] | |
| (for [tx xrange | |
| ty yrange] |
| import sbt._ | |
| import sbt.Keys._ | |
| object ScalaoauthasyncBuild extends Build { | |
| lazy val scalaoauthasync = Project( | |
| id = "scala-oauth-async", | |
| base = file("."), | |
| settings = Project.defaultSettings ++ Seq( | |
| name := "scala-oauth-async", |
Akkaのネットワーキングでは、2者間の通信を最小単位としてプロトコルを組む。
A <-- Protocol --> B
2者間のプロトコルの実装はPipelineと呼ばれる。 PipelineはAからのメッセージをBに通じるように翻訳し、一方でBからのメッセージをAに通じるように翻訳するという働きをする。
| def point(a: BufferedImage, b: BufferedImage) = | |
| for { | |
| points <- (for { | |
| ax <- 0.to(a.getWidth - b.getWidth).view | |
| ay <- 0.to(a.getHeight - b.getHeight).view | |
| } yield { | |
| for { | |
| bx <- 0.until(b.getWidth).view | |
| by <- 0.until(b.getHeight).view | |
| } yield (ax, ay) -> (bx, by) |
| ~/210x $ scala -Xshow-phases | |
| phase name id description | |
| ---------- -- ----------- | |
| parser 1 parse source into ASTs, perform simple desugaring | |
| macroparadise 2 let our powers combine | |
| namer 3 resolve names, attach symbols to named trees in paradise | |
| packageobjects 4 load package objects in paradise | |
| typer 5 the meat and potatoes: type the trees in paradise | |
| ... |
| sealed trait Status | |
| sealed trait HasID extends Status | |
| sealed trait NoID extends Status | |
| case class User[S <: Status]( | |
| firstName: String, | |
| lastName: String, | |
| age: Int, | |
| createdAt: java.util.Date, | |
| private val _id: Int = 0 |
| (ns typelogic.lisp | |
| (:refer-clojure :exclude [==]) | |
| (:require [clojure.core.logic :refer :all] | |
| [clojure.core.logic.dcg :refer :all])) | |
| (defna expr [g x t] | |
| ([[[x t] . _] x t]) | |
| ([[_ . g'] x t] (expr g' x t)) | |
| ([_ ['fn [a] b] [::-> p q]] | |
| (fresh [g'] |