This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let floored block = | |
snd block = 0 | |
let collision blocks block = | |
List.exists(fun b -> b = block) blocks | |
let otherblocks blocks block = List.filter(fun b -> b <> block) blocks | |
let rec fall blocks block = | |
let fallenBlock = (fst block, snd block - 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//test framework | |
let mutable tests = [] | |
let test f = tests <- List.append tests [f] | |
let run _ = List.map (fun f -> (f ())) tests | |
let runp _ = List.toArray tests |> Array.Parallel.map (fun f -> (f ())) | |
let (==) value1 value2 = System.Console.WriteLine("{0} expected: {1} got: {2}", (value1 = value2), value2, value1) | |
let describe description = System.Console.WriteLine(description.ToString()) | |
//implementation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mutable tests = [] | |
let test f = tests <- List.append tests [f] | |
let run _ = List.map (fun f -> (f ())) tests | |
let runp _ = List.toArray tests |> Array.Parallel.map (fun f -> (f ())) | |
let (==) value1 value2 = System.Console.WriteLine("{0} expected: {1} got: {2}", (value1 = value2), value2, value1) | |
let describe description = System.Console.WriteLine(description.ToString()) | |
type Cell = { x : int; y : int; moves : int } | |
let rec go (canGo : Cell list) (toTest : Cell list) (obstacles : Cell list)= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module runner | |
let mutable tests = [] | |
let test f = tests <- List.append tests [f] | |
let xtest f = () | |
let mutable before = fun () -> () | |
let run _ = List.map (fun f -> (before () | |
f ())) tests | |
let (==) value1 value2 = System.Console.WriteLine("{0} expected: {1} got: {2}", (value1 = value2), value2, value1) | |
let describe description = System.Console.WriteLine(description.ToString()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//test framework | |
open System | |
let mutable tests = [] | |
let test f = tests <- List.append tests [f] | |
let xtest f = () | |
let mutable before = fun () -> () | |
let run _ = List.map (fun f -> (before () | |
f ())) tests | |
let describe description = Console.WriteLine(description.ToString()) | |
let (==) value1 value2 = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let setTerminationDate agentNumber toTerminated = | |
using(new AgencyManagement()) (fun db -> | |
let agent = query <@ seq { for a in db.Agents do | |
if a.AgentNumber = agentNumber then yield a } @> |> Seq.head | |
if toTerminated = true then | |
agent.TerminationDate <- new Nullable<DateTime>(DateTime.Now) | |
else | |
agent.TerminationDate <- new Nullable<DateTime>() | |
db.SaveChanges() |> ignore | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Learn more about F# at http://fsharp.net | |
open canopy | |
open runner | |
let switchTo b = browser <- b | |
let index = "http://dry-peak-5299.herokuapp.com/" | |
let createGame = ".nav li a" | |
let cardCzar = "#notificationCardCzar" | |
let waiting = "#notificationWaitingOnRound" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Learn more about F# at http://fsharp.net | |
open System | |
let mutable tests = [] | |
let test f = tests <- List.append tests [f] | |
let xtest f = () | |
let mutable before = fun () -> () | |
let run _ = List.map (fun f -> (before () | |
f ())) tests | |
let describe description = Console.WriteLine(description.ToString()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module gherkin | |
open System.Text.RegularExpressions | |
open System.Linq | |
type Mode = Given | When | Then | |
type gwt () = class | |
let mutable mode = Given | |
let mutable givens : (unit -> unit) list = [] | |
let mutable whens : (unit -> unit) list = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open canopy | |
open runner | |
open Microsoft.FSharp.Reflection | |
type command = | |
| Ram | |
| Dragon | |
| Rat | |
| Tiger | |
| Dog |
OlderNewer