BenchmarkDotNet=v0.11.4, OS=Windows 10.0.17134.590 (1803/April2018Update/Redstone4)
Intel Core i7-4790K CPU 4.00GHz (Haswell), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=2.2.100
[Host] : .NET Core 2.2.0 (CoreCLR 4.6.27110.04, CoreFX 4.6.27110.04), 64bit RyuJIT DEBUG
DefaultJob : .NET Core 2.2.0 (CoreCLR 4.6.27110.04, CoreFX 4.6.27110.04), 64bit RyuJIT
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
open System | |
open System.IO | |
let rec seq2 s = seq { | |
match s with | |
| (s1 :: s2 :: rest) -> yield (s1, s2); yield! seq2 rest | |
| (s1 :: nil) -> yield (s1, 'Х') | |
| _ -> () | |
} |
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
open System | |
open System.IO | |
open System.Text.RegularExpressions | |
let parse s = | |
let m = Regex(@"^(?<bug>[^:]+)\s*:\s*(?:(?<area>[^,]+)\s*,?\s*)+$").Match(s) | |
(m.Groups.["bug"].Value, seq { for c in m.Groups.["area"].Captures -> c.Value }) | |
[<EntryPoint>] | |
let main _ = |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Linq; | |
using Newtonsoft.Json.Serialization; | |
namespace JsonProperties | |
{ |
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
// Client project | |
// This piece of code follows the pattern from SAFE-Dojo for loading data from API endpoints | |
open Thoth.Json | |
type Dto = int list | |
let dtoDecoder = Decode.Auto.generateDecoder<Dto> () | |
let init () = |
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
open System | |
open Microsoft.FSharp.Quotations | |
open FSharp.Quotations.Evaluator | |
type A (str: string) = | |
member val Prop: string = str with get, set | |
let inline safeGet (f: Expr<'T>): 'T option = | |
try Some(f.Evaluate()) | |
with :? NullReferenceException -> None |
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
open System | |
open System.Diagnostics | |
open System.IO | |
open FSharp.Control | |
open SharpCompress.Common | |
open SharpCompress.Readers | |
open SharpCompress.Archives | |
[<EntryPoint>] | |
let main argv = |
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
module Configuration | |
open System | |
open System.IO | |
open Microsoft.Extensions.Configuration | |
open Microsoft.Extensions.Configuration.Binder | |
open Microsoft.Extensions.Configuration.Json | |
open LinqToDB.Configuration | |
let [<Literal>] private SqlServer = "SqlServer" |
fake build -t all --env a=b --env c=d --env e=f
*** [Env ("a","b"); Env ("c","d"); Env ("e","f")]
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 reqs = [| 0 .. 6 |] | |
let chunks = [| 4; 1; 2 |] | |
let splitter rq ch = | |
let rec splitter' r (c:seq<int>) = seq { | |
if not(Seq.isEmpty c) then | |
let cx = c |> Seq.take 1 |> Seq.exactlyOne | |
yield r |> Seq.take cx | |
yield! splitter' (Seq.skip cx r) (Seq.skip 1 c) | |
} |
OlderNewer