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
// dotnet fsi tasty.fsx | |
#I @"C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.11" | |
#r "System.Windows.Forms" | |
open System | |
open System.Runtime.InteropServices | |
open System.Windows.Forms | |
[<Struct>] |
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
@prefix log: <http://www.w3.org/2000/10/swap/log#> . | |
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | |
@prefix math: <http://www.w3.org/2000/10/swap/math#> . | |
@prefix time: <http://www.w3.org/2006/time#> . | |
@prefix pred: <http://www.w3.org/2007/rif-builtin-predicate#>. | |
@prefix : <http://www.w3.org/2006/time/aux#> . | |
# instant comparison | |
# TODO: should cover many more cases than just dateTime |
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 "nuget: dotNetRdf.Core" | |
open VDS.RDF | |
open VDS.RDF.Parsing | |
let graph = new Graph() | |
StringParser.Parse(graph, " | |
@prefix : <http://example.org/> . | |
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . |
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 "System.Xml.Linq" | |
open System.Xml.Linq | |
let htmlSummary primo secondo = | |
let tag name content = XElement(XName.Get name, content) | |
let em (text: string) = tag "em" [| text |] | |
let li key value = tag "li" [| key; em value |] | |
[| | |
li "primo" primo |
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 "System.Xml.Linq" | |
open System.Xml | |
open System.Xml.Linq | |
let elements ns name uri = | |
seq { | |
use reader = XmlReader.Create(inputUri = uri) | |
let onElement() = reader.LocalName = name && reader.NamespaceURI = ns | |
while onElement() || reader.ReadToFollowing(name, ns) do | |
yield XNode.ReadFrom(reader) :?> XElement } |
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
[Fact] | |
public async Task TransformBlockPreserveOrder() | |
{ | |
const int badItem = 89; | |
var results = new List<int>(); | |
var input = Enumerable.Range(1, int.MaxValue); | |
var mapBlock = new TransformBlock<int, int>( | |
x => x == badItem? throw new Exception("bug") : x, | |
new ExecutionDataflowBlockOptions {MaxDegreeOfParallelism = 10}); |
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\Fare.1.0.0\lib\net35\Fare.dll" | |
#r @"..\packages\FsCheck.2.0.4\lib\net45\FsCheck.dll" | |
open Fare | |
open FsCheck | |
open System.Collections.Generic | |
// partial and naive implementation of a generator attempting to honor the size | |
let generator pattern = | |
// pre-compute a certain amount of values and group them by size |