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
expected | |
[ %results | |
[ %result-set | |
[ %vector | |
[%tmsp ~.da ~2000.1.9] | |
[%ship ~.p 0] | |
[%agent ~.tas '/test-agent'] | |
[%namespace ~.tas %ref] | |
[%table ~.tas %my-table-4] | |
~ |
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
(* | |
Decision Table Demo | |
MIT License, do with this what you will | |
A demo of decision tables using F# types and pattern matching, inspired by https://www.hillelwayne.com/post/decision-table-patterns/ | |
The compiler service flags problematic (incomplete) decision tables. | |
Requirements: |
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 "<path to nuget>/.nuget/packages/fsharp.data/3.3.2/lib/netstandard2.0/FSharp.Data.dll" | |
open FSharp.Data | |
open System | |
type Comment = | |
{ | |
Url : Uri | |
Tag : string |
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
// Fibonacci | |
// not originally mine, can't remember where I got it | |
// State Monad combined with Continuation Monad (StateT Mondad transformer) | |
type StateContMonad<'s, 'a, 'r> = | |
StateContMonad of ('s -> ('s -> 'a -> 'r) -> 'r) | |
type StateContBuilder() = | |
member __.Return value = | |
StateContMonad (fun state k -> k state value) |
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
//not tested as fsx, but insert into existing fs in a project and you should see error messages other than bad tab | |
//did not let me save gist with tabs | |
//so insert them yourself in some other editor in line 21 | |
type Production = | |
{ | |
Ident : int | |
Year: int | |
Month: int | |
OilProduced: float | |
WaterProduced: float |
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
one name publlic verification |
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
/// <reference path="C:\Users\Jack\AppData\Local\Microsoft\VisualStudio\14.0\Macros\dte.js" /> | |
// Blog announcing new VS macro facility: | |
// https://blogs.msdn.microsoft.com/visualstudio/2016/05/11/macros-extension-open-sourced-in-visual-studio-2015 | |
// | |
// Macros get saved to: | |
// <user>\AppData\Local\Microsoft\VisualStudio\14.0\Macros\Macros | |
// does not seem to be any way to change default folder. Roaming may also work, but I have not experimented with that. | |
// | |
// Tne open source project: | |
// https://github.com/Microsoft/VS-Macros |
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
//Demo SQLite cannot run from FSI | |
//#load "load-references-debug.fsx" | |
#I __SOURCE_DIRECTORY__ | |
#r "../../packages/Microsoft.Data.Sqlite.1.0.0-rc1-final/lib/net451/Microsoft.Data.Sqlite.dll" | |
open Microsoft.Data.Sqlite | |
let conn = new SqliteConnection(@"Data Source = :memory:") |
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
namespace TypeSystemSandbox | |
#if INTERACTIVE | |
#load @"C:\FsEye\FsEye.fsx" | |
#I "C:\Packages" | |
#endif | |
open System | |
//constraints from "Constraints (F#)" MS F# Language Reference |
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 forcedReveal doorWithPrize fstChoice = | |
match (doorWithPrize + fstChoice) with | |
|3 -> 3 | |
|4 -> 2 | |
|_ -> 1 |
NewerOlder