View gist:99e208bf1801a47f96d1
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 |
View gist:b3838c25b2285bdff0aa
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 |
View gist:56cc39dc881aabb904ba
// 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 ] |
View gist:d3b6347051b07484db21
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 |
View gist:699443054cfb1d479df1
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 |
View gist:6623d02d1a6065a7f9e0
type Domain = interface end | |
type Projection<'R> = | |
abstract member source : Table<'R> | |
and Table<'R> = inherit Projection<'R> | |
and Table<'R, 'K> = | |
inherit Table<('R * 'K)> | |
abstract member row : 'R | |
abstract member key : 'K | |
type proj<'R> = Projection<'R> |
View gist:f07a195a5f0f412b34ec
[<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 |
View gist:d02446c3e139a7b81f28
open System | |
type MyCollection() = | |
interface IDisposable | |
let d = new MyCollection() | |
(d :> IDisposable).Dispose() | |
let v = (printfn "hello"; [100]) |
View gist:b80086ce5c5a0dc1a9f7
//custom type | |
type SomeType(v) = member x.V = v | |
[<AutoOpen>] | |
module Aux1 = | |
//custom type that can carry measure | |
[<MeasureAnnotatedAbbreviation>] | |
type SomeType<[<Measure>] 'm>(v) = | |
member x.V = v |
View gist:034956eb0f41a5ff1aa6
namespace TODOList | |
open WebSharper | |
open WebSharper.JavaScript | |
open WebSharper.JQuery | |
open WebSharper.UI.Next | |
open WebSharper.UI.Next.Client | |
[<JavaScript>] | |
module Code = |
OlderNewer