Skip to content

Instantly share code, notes, and snippets.

let rotateList amount initialList =
let rec rotate amount myList =
if amount = 0
then myList |> List.rev
else
let newestList =
match myList |> List.rev with
| h::rest ->
let newList = (rest@[h]) |> List.rev
open System
open System.IO
type Line = string
type Load = string
type Lines = Line list
type Loads = Load list
type Code = Lines
type FsxPath = string
@monkieboy
monkieboy / vscodeAndPaket.sh
Created January 31, 2017 12:05
Shell script F# functions to add to .bashrc on *nix systems
code () {
if [[ $# = 0 ]]
then
open -a "Visual Studio Code"
else
[[ $1 = /* ]] && F="$1" || F="$PWD/${1#./}"
open -a "Visual Studio Code" --args "$F"
fi
}
open System
open System.IO
open edu.stanford.nlp.ling
open edu.stanford.nlp.neural.rnn
open edu.stanford.nlp.sentiment
open edu.stanford.nlp.trees
open edu.stanford.nlp.util
open java.util
open edu.stanford.nlp.pipeline
module ProgNet.Program
open System
open ProgNet.ClimbHill
[<EntryPoint>]
let main argv =
let printTitle title =
printfn ""
open FsCheck
let newDeck =
[ for r in [1..14] do
yield ("C",r)
yield ("H",r)
yield ("D",r)
yield ("S",r) ]
let genFullShuffledDeck =
gen
let genHand : Gen<Hand> =
let deck =
gen {
let! seed = Gen.choose (0, 100000)
let deck = shuffle newDeck seed
return deck }
gen {
let! (ShuffledDeck d) = deck
let hand =
let time countN label f =
let stopwatch = System.Diagnostics.Stopwatch()
System.GC.Collect()
printfn "Started"
let getGcStats() =
let gen0 = System.GC.CollectionCount(0)
let gen1 = System.GC.CollectionCount(1)
let gen2 = System.GC.CollectionCount(2)
@monkieboy
monkieboy / films.fsx
Last active December 23, 2015 15:13
Top 100 Grossing Films (as of 23 December 2015) unsorted
let films :list<string*int64> =
[ ("Inside Out", 851458049L)
("Star Wars Episode III: Revenge of the Sith", 848754768L)
("Spectre", 837191062L)
("Transformers: Revenge of the Fallen", 836303693L)
("The Twilight Saga: Breaking Dawn – Part 2", 829746820L)
("Inception", 825532764L)
("Spider-Man", 821708551L)
("Independence Day", 817400891L)
("The Hobbit: An Unexpected Journey", 1021103568L)
@monkieboy
monkieboy / range.fsx
Created November 17, 2015 14:07
Playing with ranges
let (..) (start:int) (limit:int) =
let sequence = [start..limit]
let decapitate h t =
if t = List.empty
then [ h ]
else t |> List.rev
let reversed =
match sequence with