Skip to content

Instantly share code, notes, and snippets.

View jcazevedo's full-sized avatar

Joao Azevedo jcazevedo

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jcazevedo on github.
  • I am jcazevedo (https://keybase.io/jcazevedo) on keybase.
  • I have a public key ASCmfreJ1r74yTTw82epE3z6HZSH4OqfyxtHGrCCVNy2xAo

To claim this, I am signing this object:

@jcazevedo
jcazevedo / gist:3849885
Created October 7, 2012 23:00 — forked from anonymous/gist:3847798
Simple Non-Polymorphic Stack Machine
import scala.util.Random
object PStack {
type Any = PStack[_, _]
}
sealed trait PStack[A, B <: PStack.Any] {
def pop2: Option[(A, B)]
def push0[C](elem: C): PStack[C, PStack[A, B]] =
NonEmptyPStack(elem, this)
@jcazevedo
jcazevedo / SleepSort.scala
Created May 21, 2012 15:51
SleepSort in Scala
import scala.actors.Future
import scala.actors.Futures._
object SleepSort {
def main(args: Array[String]) = {
var sorted = List[Int]()
var futures = for (a <- args) yield future {
Thread.sleep(a.toInt * 1000)
sorted :::= List(a.toInt)
a.toInt