Skip to content

Instantly share code, notes, and snippets.

@stefanalfbo
stefanalfbo / VBHelper.fs
Created October 8, 2012 18:10
vb6 helper for FAKE
let vb6exe =
ProgramFilesX86 @@ "Microsoft Visual Studio\\VB98" @@ "VB6.exe"
let VB6Build outputPath projects =
let build outputPath project =
traceStartTask "VB6Build" project
let args = sprintf "/make %s /outdir %s" project outputPath
tracefn "Building project: %s\n %s %s" project vb6exe args
@stefanalfbo
stefanalfbo / extract from fsharp repository.fs
Created March 27, 2012 18:49
Pipeline operator implementations from the fsharp repository
let inline (|>) x f = f x
let inline (||>) (x1,x2) f = f x1 x2
let inline (|||>) (x1,x2,x3) f = f x1 x2 x3
let inline (<|) f x = f x
let inline (<||) f (x1,x2) = f x1 x2
let inline (<|||) f (x1,x2,x3) = f x1 x2 x3
@stefanalfbo
stefanalfbo / more simple pipeline operator examples.fs
Created March 27, 2012 18:46
More simple pipeline operator examples in F#
// Pipeline in the opposite direction
> double <| 10;;
val it : int = 20
> subtract 2 <| 4;;
val it : int = 2
// Pipeline with a tuple
> (2, 4) ||> subtract;;
val it : int = 2
@stefanalfbo
stefanalfbo / Simple examples of pipeline operator.fs
Created March 27, 2012 18:39
Simple examples of pipeline operator in F#
// Some functions to play with
let double x = x * 2
let triple x = x * 3
let square x = x * x
// fsi
>2 |> double;;
val it : int 4
let pipelining n =
@stefanalfbo
stefanalfbo / memoization_simple.fs
Created February 29, 2012 22:04
Simple F# memoization
open System.Collections.Generic
// A simple function with some built in delay
// val square : int -> int
let square x =
System.Threading.Thread.Sleep(x * 1000)
x * x
// A generic memoization function that takes a function with one parameter
// val memoization : ('a -> 'b) -> ('a -> 'b) when 'a : equality