View terminology.pdf
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View lunar.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! Translation of | |
//! <http://www.cs.brandeis.edu/~storer/LunarLander/LunarLander/LunarLanderListing.jpg> | |
//! by Jim Storer from FOCAL to Rust. | |
use std::error::Error; | |
use std::io; | |
use std::io::prelude::*; | |
use std::marker::{Send, Sync}; | |
use std::process; | |
use std::str::FromStr; |
View LinVect.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object LinVect { | |
type K = Double | |
trait NAT[N] { val nat: Int } | |
def NAT[N: NAT]: NAT[N] = implicitly | |
def nat[N: NAT]: Int = NAT[N].nat | |
trait NAT_10 | |
implicit object NAT_10 extends NAT[NAT_10] |
View CAT.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cat | |
object CAT { | |
// system traits | |
sealed trait Type[Self <: Type[Self]] | |
sealed trait Of[Self <: Of[Self, T], T <: Type[T]] | |
// types | |
case class Ob() |
View CCC.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Scala Types are objects of Cartesian Closed Category | |
// (w/o equalities, probably not a category, sorry) | |
object CCC { | |
// category structure | |
def id[T0]: T0=>T0 = x0=>x0 | |
def mul[T1, T2, T3](f23: T2=>T3, f12: T1=>T2): (T1=>T3) = x1 => f23(f12(x1)) | |
// terminal object; adjunction; | |
type _1_ = Unit |
View package.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package object types { | |
import scala.language.reflectiveCalls | |
import scala.language.higherKinds | |
// quantifiers aka (co)ends | |
type Forall[+F[_]] = { def apply[X]: F[X] } | |
type Exists[+F[_]] = F[_] | |
// basic categorical notions |
View EnvHacker.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait EnvHacker { | |
/** | |
* Portable method for setting env vars on both *nix and Windows. | |
* @see http://stackoverflow.com/a/7201825/293064 | |
*/ | |
def setEnv(newEnv: Map[String, String]): Unit = { | |
try { | |
val processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment") | |
val theEnvironmentField = processEnvironmentClass.getDeclaredField("theEnvironment") | |
theEnvironmentField.setAccessible(true) |
View ::.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final case class ::[B](private var hd: B, private[scala] var tl: List[B]) extends List[B] | |
override def head: B = hd | |
override def tail: List[B] = tl | |
override def isEmpty: Boolean = false | |
private def readObject(in: ObjectInputStream): Unit = | |
val firstObject = in.readObject() | |
hd = firstObject.asInstanceOf[B] | |
assert(hd != ListSerializeEnd) | |
var current: ::[B] = this |
View TxMapTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.atomic.AtomicReference | |
import java.util.concurrent.CountDownLatch | |
import scala.concurrent.Future | |
import scala.concurrent.ExecutionContext | |
import ExecutionContext.Implicits.global | |
object TxMapTest { | |
/* | |
* Example Usage | |
* We want to show two threads working with the same data source having both of their effects succeed |
NewerOlder