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 { |
// kinja-service library | |
trait AdressBook { | |
val ssoActorPath: String | |
val inviteActorPath: String | |
} | |
class SsoService extends ApiService { | |
self: AddressBook => | |
// kinja-service library | |
class SsoService extends ApiService { | |
def authorByToken(token: String): Author = { | |
lookupAuthorInDatabase(token) | |
} | |
} | |
trait SsoServiceContract { | |
// kinja-service library | |
class SsoService extends ApiService { | |
def authorByToken(token: String): Author = { | |
lookupAuthorInDatabase(token) | |
} | |
} | |
case class AuthorByToken(token: String) |
// kinja-service library | |
class SsoService extends ApiService { | |
def authorByToken(token: String): Author = { | |
lookupAuthorInDatabase(token) | |
} | |
} | |
class InvitesService extends Service { | |
def invite(token: String, invitee: Author, authorResolver: String => Author): Unit = { |
// kinja-service library | |
trait SsoServiceComponent extends ServiceComponent { | |
val ssoService: SsoService | |
class SsoService extends Service { | |
def authorByToken(token: String): Author = { | |
lookupAuthorInDatabase(token) | |
} |