Skip to content

Instantly share code, notes, and snippets.

View tpolecat's full-sized avatar
🔥
Dijkstra would not have liked this.

Rob Norris tpolecat

🔥
Dijkstra would not have liked this.
View GitHub Profile
package angles
import spire.algebra._
import scala.math.Pi
object Angle {
def apply(n: Double): Angle =
if (n < 0.0) new Angle(n % 360.0 + 360.0) else new Angle(n % 360.0)
def fromRadians(n: Double): Angle =
Angle(n * 360.0 / (2.0 * Pi))
scala> def foo[A[_]] = 1
foo: [A[_]]=> Int
scala> foo[List]
res11: Int = 1
scala> foo[Int]
<console>:24: error: Int takes no type parameters, expected: one
foo[Int]
^
// rank 1
type num[a] = (a => a) => a => a
def zero[a]: num[a] = f => x => x
def succ[a](n: num[a]): num[a] = f => x => f(n(f)(x))
def eval(n: num[Int]): Int = n(_ + 1)(0)
// rank 2
@tpolecat
tpolecat / infset.scala
Created December 22, 2013 17:29 — forked from non/infset.scala
package spire.examples
import spire.algebra._
import spire.math.{Natural, UInt}
import scala.collection.mutable
object SetUtil {
def powerStream[A](members: Stream[A]): Stream[Set[A]] = {
val done = Stream.empty[Set[A]]
# AdAway default blocklist
# Blocking mobile ad providers and some analytics providers
#
# Project home page:
# https://github.com/AdAway/adaway.github.io/
#
# Fetch the latest version of this file:
# https://raw.githubusercontent.com/AdAway/adaway.github.io/master/hosts.txt
#
# License: