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
type Message = | |
| Sleep of int*int | |
| SyncPoint of AsyncReplyChannel<unit> | |
let agent = | |
MailboxProcessor.Start(fun inbox -> | |
let rec loop() = | |
async { | |
let! msg = inbox.Receive() | |
match msg with |
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
type ChessboardState = | |
{Row:bool[]; DiagPlus:bool[]; DiagMin:bool[]} | |
let inline diagMinInd (chessboard:ChessboardState) (x,y) = | |
if x-y>=0 then x-y else x-y+chessboard.DiagMin.Length | |
let canPlaceOn (chessboard:ChessboardState) (x,y) = | |
chessboard.Row.[y] && chessboard.DiagPlus.[x+y] && chessboard.DiagMin.[diagMinInd chessboard (x,y)] | |
let changeState (chessboard:ChessboardState) (x,y) = |
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
type I<'T> = interface end | |
type I1<'T> = inherit I<'T> | |
type I2<'T> = inherit I<'T> | |
type A = | |
inherit I1<int> | |
inherit I2<double> |
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
interface I<T> | |
{} | |
interface I1<T> : I<T> | |
{} | |
interface I2<T> : I<T> | |
{} | |
class A : I1<int>, I2<double> | |
{} |
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
#r @"System.Management.Automation.dll" | |
#r @"PowerShellTypeProvider.dll" | |
type PS = FSharp.PowerShell.PowerShellTypeProvider< PSSnapIns="", Is64BitRequired=false > | |
PS.``Get-Item``() |
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
//--------- Sample 1 ------------- | |
/// Factorial | |
let rec fact n = | |
if n = 1 then 1 | |
else n*fact(n-1) | |
/// Tail optimized Factorial | |
let fact n = | |
let rec factImpl n acc = // acc = accumulator |
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
*** Assembly Binder Log Entry (10/30/2013 @ 11:29:27 PM) *** | |
The operation failed. | |
Bind result: hr = 0x80070002. The system cannot find the file specified. | |
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll | |
Running under executable D:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe | |
--- A detailed error log follows. | |
=== Pre-bind state information === |
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 shift (s:string) (k:int) = | |
System.String( | |
s.ToCharArray() | |
|> Array.map (function | |
| x when 'a' <= x && x <='z' -> | |
let code = int(x)-int('a') | |
char(int('a') + (code + k + 26) % 26) | |
| x -> x ) | |
) |
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
type BaseProvidedType() = | |
static let mutable _host = "" | |
static member Host | |
with get() = _host | |
and set(value) = _host <- value | |
type ProvidedType() = inherit BaseProvidedType() | |
ProvidedType.Host <- "1" | |
BaseProvidedType.Host // = "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
Microsoft (R) F# Interactive version 14.0.23413.0 | |
Copyright (c) Microsoft Corporation. All Rights Reserved. | |
For help type #help;; | |
> | |
--> Referenced 'D:\GitHub\FsProjectsAdmin\src\../.paket/paket.exe' |