Skip to content

Instantly share code, notes, and snippets.

@brodyberg
brodyberg / typeprovider_ast
Created May 6, 2015 19:12
Getting AST for F# Type-Provider action
#I @"..\packages\FSharp.Data.2.2.0\lib\net40"
#r @"..\packages\FSharp.Data.2.2.0\lib\net40\FSharp.Data.dll"
open FSharp.Data
type Stocks = CsvProvider<"msft.csv">
let stockData = Stocks.Load("msft.csv")
// Show AST of Rows getter
<@ stockData.Rows @>.Raw
@brodyberg
brodyberg / FsPicklerVsFSharpCore
Created April 21, 2015 15:24
Can't find FSharp Core 4.4
Microsoft (R) F# Interactive version 14.0.22214.0
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
>
[Loading C:\Users\brodyb\Desktop\MBrace.StarterKit-master\packages\MBrace.Azure.Standalone\MBrace.Azure.fsx
Loading C:\Users\brodyb\Desktop\MBrace.StarterKit-master\azure\HandsOnTutorial\credentials.fsx]
@brodyberg
brodyberg / gist:51b68f7d7918d15690fa
Created January 23, 2015 22:31
Programming the Microsoft HoloLens API
“Thanks for your interest and inquiry about getting started with HoloLens.
You can find a lot of great information about the program at the HoloLens
Microsoft site: http://www.microsoft.com/microsoft-hololens/en-us and sign
up to be the first to learn new information about the program. We have a
central team who are coordinating all HoloLens inquiries. Here is the best
way to contact that team:
https://33581registration.azurewebsites.net/registration.aspx As you
can imagine, we are getting a lot of interest, so please don’t expect an
immediate response from them. We are excited to have you involved but we
are early in the process so demos and access may not be possible for a while. “
@brodyberg
brodyberg / gist:c0acd46d83c08facc493
Last active August 29, 2015 14:08
F# Computation Expression.Bind Explained in the Simplest Possible Language
// F# Computation Expressions Explained in the Simplest Way I Know How:
// see end for links
// me: @brodyberg
// EXAMPLE 1: Make a binding that only ever works
// Nothing happens in Bind which interferes with the success
// of the assignment of "bar" to foo or "baz" to bar etc.
type OnlyContinueBuilder () =
// all Bind does is make the binding happen, i.e. apply x to f
@brodyberg
brodyberg / FSharp_Pipe_AST
Created August 6, 2014 17:29
AST for an F# program with a |> operator
Microsoft (R) F# Compiler version (private)
Copyright (c) Microsoft Corporation. All Rights Reserved.
AST:
ImplFile
(ParsedImplFileInput
("C:\visualfsharp\tests\fsharpqa\Source\Pipe\Program.fs",false,QualifiedNameOfFile Program,[],[],
[SynModuleOrNamespace
([Program],true,
[Let
(false,
c:\Users\brodyb\Desktop\newTest>RunMapSetTests.bat
c:\Users\brodyb\Desktop\newTest>set _=c:\Users\brodyb\Desktop\newTest\runMapSetTests.ps1
Starting FSharp Map and Set Performance Tests
Map and Set performance tests authored by John Harrop (https://github.com/jdh30)
Powershell script by Brody Berg (https://github.com/brodyberg)
Create Directory...
Working directory: c:\Users\brodyb\Desktop\newTest\
Creating fsharp_test
Release brodyberg$ mono MapSet.exe
Generating Maps...
Running Map<int, int> benchmarks...
Running Map<string, int> benchmarks...
Running Map<int * int, int> benchmarks...
Generating Sets...
Running Set<int> benchmarks...
Running Set<string> benchmarks...
Running Set<int * int> benchmarks...
Generating more Sets...
Release brodyberg$ mono PerfComparison.exe
Results from running PerfComparison (https://github.com/jack-pappas/fs-core-optimized)
Random set density parameter: 0.846814
RNG seed: 1305406417
----
Warming up...done.
Create Random Set<int> (n=1000000)
FSharp.Core (Original) : 3259.647000 (ms)
Results from running PerfComparison (https://github.com/jack-pappas/fs-core-optimized)
Random set density parameter: 0.838325
RNG seed: 1493062694
----
Warming up...done.
Create Random Set<int> (n=1000000)
FSharp.Core (Original) : 3594.840100 (ms)
FSharp.Core (Optimized) : 2593.983100 (ms)
Results from running PerfComparison (https://github.com/jack-pappas/fs-core-optimized)
Random set density parameter: 0.397987
RNG seed: 1315380688
----
Warming up...done.
Create Random Set<int> (n=1000000)
FSharp.Core (Original) : 3196.920400 (ms)
FSharp.Core (Optimized) : 2576.573300 (ms)