Skip to content

Instantly share code, notes, and snippets.

View cdrnet's full-sized avatar

Christoph Ruegg cdrnet

View GitHub Profile
@thinkbeforecoding
thinkbeforecoding / CodeHash.fs
Last active August 29, 2015 14:02
This creates a hash code of a F# Expr. The hash code changes when the code change
open Microsoft.FSharp.Quotations
open Microsoft.FSharp.Quotations.Patterns
open System.Reflection
let hashList f seed = List.fold (fun h v -> h * 37 + f v) seed
let (<+) x y = x * 37 + y
let (!<) f x y = x <+ f y
let rec hashC funcs =
@MartinBodocky
MartinBodocky / asyncParallel
Last active August 29, 2015 13:58
Asynchronous and Parallel Programming in F#
// Creating new threads
open System
open System.Threading
//What will execute on each thread
let threadBody() =
for i in 1..5 do
//Wait 1/10 of a second
Thread.Sleep(100)
printfn "[Thread %d] %d ..."
@ovatsus
ovatsus / Setup.fsx
Created March 17, 2012 17:07
Script to setup F# Interactive session, loading everything in the current solution
#r "System.Xml.Linq"
open System
open System.IO
open System.Xml.Linq
let script = seq {
//TODO: this currently loads fsproj's in alphabeticall order, we should instead
//build the dependencies graph of the fsproj's and load them in topological sort order