Skip to content

Instantly share code, notes, and snippets.

View 7sharp9's full-sized avatar

Dave Thomas 7sharp9

  • Moirae Software Engineering Ltd
  • UK
  • X @7sharp9_
View GitHub Profile
@7sharp9
7sharp9 / barbershop.scala
Created July 1, 2011 11:48 — forked from toluju/barbershop.scala
A better scala barbershop simulator.
import scala.actors.Actor
import scala.actors.Actor._
import scala.util.Random
import scala.collection.{immutable, mutable}
val rand = new Random()
case class Customer(id: Int) {
var shorn:Boolean = false
}
@7sharp9
7sharp9 / desugaredasync.fs
Created May 17, 2011 00:56
desugared async
namespace Pipelets
open System
open System.Reflection
open System.Collections.Concurrent
open FSharp.Control
type pipelet<'a,'b>(processor, router: seq<IPipeletInput<'b>> * 'b -> seq<IPipeletInput<'b>>, capacity, ?overflow, ?blockingTime) =
let buffer = BlockingQueueAgent<_> capacity
let routes = ref List.empty<IPipeletInput<'b>>
let queuedOrRunning = ref false