This file contains hidden or 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
type Building = | |
{ left : int | |
right : int | |
height : int } | |
let buildings = [] | |
let getHeight building = building.height | |
let getWidth building = building.right - building.left | |
let getArea building = getHeight building * getWidth building |
This file contains hidden or 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
#r @"packages\Eto.Forms.1.3.0\lib\net40\Eto.dll" | |
#r @"packages\Eto.Platform.Windows.1.3.0\lib\net40\Eto.Platform.Windows.dll" | |
open System | |
open Eto.Forms | |
open Eto.Drawing | |
This file contains hidden or 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
//========================================== | |
// Hypothetical fully self-contained getting-started example for Suave Web Server scripting | |
// | |
// This script fetches the Paket.exe component which is referenced later in the script. | |
// Initially the #r "paket.exe" reference is shown as unresolved. Once it has been | |
// downloaded by the user (by executing the first part of the script) the reference | |
// shows as resolved and can be used. | |
//------------------------------------------ |
This file contains hidden or 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
//========================================== | |
// Working fully self-contained getting-started example for Suave Web Server scripting | |
// | |
// Note you don't need to have _anything_ installed before starting with this script. Nothing | |
// but F# Interactive and this script. | |
// | |
// This script fetches the Paket.exe component which is referenced later in the script. | |
// Initially the #r "paket.exe" reference is shown as unresolved. Once it has been | |
// downloaded by the user (by executing the first part of the script) the reference | |
// shows as resolved and can be used. |
This file contains hidden or 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
C:\GitHub\dsyme\visualfsharp>.\appveyor-build.cmd | |
C:\GitHub\dsyme\visualfsharp>set APPVEYOR_CI=1 | |
C:\GitHub\dsyme\visualfsharp>if not '12.0' == '' goto vsversionset | |
C:\GitHub\dsyme\visualfsharp>echo Visual Studio Version = 12.0 | |
Visual Studio Version = 12.0 | |
C:\GitHub\dsyme\visualfsharp>if '12.0' == '' echo Error: Could not find a Visual |
This file contains hidden or 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
// assumed | |
let FindPackages(_,_,_,_) = [| "package" |] | |
type Source = { IsNuget: bool; Url: string } | |
let DefaultNugetSource = { IsNuget = true; Url = "http://nuget.org" } | |
//------------------------------- | |
// using parallel merged asyncSeq's | |
let SearchPackagesByName(sources, search) = | |
let sources = [ yield! sources; yield DefaultNugetSource ] |
This file contains hidden or 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
http://benchmarksgame.alioth.debian.org/u64/program.php?test=fannkuchredux&lang=fsharp&id=1 | |
Fri, 22 May 2015 04:36:01 GMT | |
MAKE: | |
mv fannkuchredux.fsharp fannkuchredux.fs | |
/usr/local/bin/fsharpc --target:exe --platform:x64 -O -o fannkuchredux.fsharp_run.exe fannkuchredux.fs | |
F# Compiler for F# 3.1 (Open Source Edition) | |
Freely distributed under the Apache 2.0 Open Source License |
This file contains hidden or 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 fannkuch n = | |
begin | |
let perm1 = Array.create n 0 in for i = 0 to (n-1) do perm1.[i] <- i done; | |
let perm = Array.create n 0 | |
let count = Array.create n 0 | |
let mutable flips = 0 | |
let mutable maxflips = 0 | |
let mutable checksum = 0 | |
let mutable nperm = 0 | |
let mutable r = n |
This file contains hidden or 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 System | |
type MyCollection() = | |
interface IDisposable | |
let d = new MyCollection() | |
(d :> IDisposable).Dispose() | |
let v = (printfn "hello"; [100]) |
This file contains hidden or 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
[<Struct>] | |
type S(x:int) = | |
member a.X = x | |
// Using the explicit struct constructor | |
let v1 = [ 1..3 ] |> List.map S |> List.map (fun x -> x.X) | |
// Using the default struct constructor |
OlderNewer