Skip to content

Instantly share code, notes, and snippets.

Alex Galis (University College of London, UK)
Antonio Manzalini (Telecom Italia, Italy)
Carlos Becker Westphall (Federal University of Santa Catarina)
Christian Destré (Orange Labs, France)
Daphné Tuncer, (University College London, United Kingdom)
Djamal Zeghlache (Telecom SudParis, France)
Imen Grida Ben Yahia (Orange labs, France)
John Strassner (Futurewei, US)
Kostas Pentikousis (EICT, Germany)
Kostas Tsagkaris (UPRC/WINGS ICT Solutions, Greece)
@rby
rby / fib.hs
Created April 21, 2011 13:18
fib implementation in supposed log(n)
{-# LANGUAGE BangPatterns #-}
module Main where
import Test.QuickCheck
import System (getArgs)
data M = M !Integer !Integer !Integer !Integer
M a b c d <*> M a' b' c' d' =
M (a*a'+b*c') (a*b'+b*d')
@rby
rby / autoclose.scala
Created December 9, 2010 07:01
Autoclose with for comprehensions
object closable {
type Closable = { def close }
class Autoclose[A <: Closable](c: A){
def foreach(f: A => Unit) = {
try { f(c) }finally { c.close }
}
}
case class Connection(name:String) {
def close = println("closing " + this)
}