I hereby claim:
- I am privateblue on github.
- I am mikolajszabo (https://keybase.io/mikolajszabo) on keybase.
- I have a public key ASBPSbXL4MOm_Zallxta1cyZqgEZSGT0IMRGzLHaK-Owrgo
To claim this, I am signing this object:
| object nqueens2 { | |
| import math._ | |
| case class V(x: Int, y: Int) { | |
| def -(v: V): V = V(x - v.x, y - v.y) | |
| def +(v: V): V = V(x + v.x, y + v.y) | |
| def lineWith(v: V, n: Int): List[V] = extend(v, n) ++ v.extend(this, n) |
| object nqueens1 { | |
| import math._ | |
| case class V(x: Int, y: Int) { | |
| def -(v: V): V = V(x - v.x, y - v.y) | |
| } | |
| def solve(n: Int): List[V] = attempt(n, grid(n), List()) | |
| // given an expected queen count, a list of still available squares, and a |
| case class Point(x: Int, y: Int) { | |
| lazy val neighbours = Set(Point(x-1,y), Point(x+1,y), Point(x,y-1), Point(x,y+1)) | |
| } | |
| case class Polyomino(squares: Set[Point]) { | |
| def op(f: Point => Point) = copy(squares = squares.map(f)) | |
| val order = squares.size | |
| lazy val mx = if (squares.isEmpty) 0 else squares.map(_.x).max |
I hereby claim:
To claim this, I am signing this object:
| import play.api.libs.json._ | |
| /** | |
| * IdT represents a typed unique identifier. The type of IdT is the type of the | |
| * object that it points to. Thus an IdT[Blog] is the unique identifier of a blog. | |
| * It is meant to be imported as import IdT => Id to replace old non-typed ids | |
| * which are of type IdT[Nothing]. The covariance of IdT is only for backward | |
| * compatibility. | |
| */ | |
| class IdT[+A] private (val key: Long) extends AnyVal with Ordered[IdT[_]] with Serializable { |
| import scala.annotation._ | |
| object chapter3 { | |
| /** | |
| * PATTERN MATCHING | |
| */ | |
| val foo = (1, 2) |
| import akka.actor.ActorSystem | |
| import akka.actor.Status | |
| import akka.pattern.ask | |
| import akka.pattern.AskTimeoutException | |
| import akka.util.Timeout | |
| import akka.util.ByteString | |
| import akka.io.IO | |
| import akka.http.Http | |
| import akka.http.model._ |
| function simplefib(n) { | |
| if (n <= 1) { | |
| return n; | |
| } else { | |
| return fib(n - 1) + fib(n - 2); | |
| } | |
| } | |
| function fib(n) { | |
| var loop = function(i, acc, x) { |
| object chapter2 { | |
| def simplefib(n: Int): Int = | |
| if (n <= 1) n | |
| else simplefib(n - 1) + simplefib(n - 2) | |
| def fib(n: Int): Int = { | |
| @annotation.tailrec | |
| def loop(i: Int, acc: Int, x: Int): Int = | |
| if (i <= 0) acc |
| case class MyPreciousModelDefined( | |
| id: Id, | |
| name: String, | |
| description: String, | |
| meta: MyPreciousMeta | |
| ) | |
| case class MyPreciousModelWithNameWithDescription( | |
| id: Id, | |
| name: String, |