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
| // Boyer Moore String Search Algorithm | |
| open System | |
| open System.Collections | |
| /// Returns the index of the given character in the English alphabet counting from 0 | |
| let alphabet_index (ch:char) = | |
| let chlow = Char.ToLower( ch) | |
| let charnum = Convert.ToInt32 chlow | |
| charnum - 97 // 'a' is ASCII character 97 |
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
| [<System.Runtime.CompilerServices.Extension>] | |
| type ExtensionMethods() = | |
| [<System.Runtime.CompilerServices.Extension>] | |
| static member inline GetOption< ^a,'k,'v when 'a : (member TryGetValue : 'k * ('v byref) -> bool)>(this : ^a, key : 'k) = | |
| let mutable v = Unchecked.defaultof<'v> | |
| let scc = ( ^a : (member TryGetValue : 'k * ('v byref) -> bool) this, key, &v) | |
| if scc then | |
| Some v | |
| else | |
| None |
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
| open System | |
| type message = string | |
| let logEvent = Event<message> () | |
| let logStream, post = logEvent.Publish, logEvent.Trigger | |
| logStream.Add <| printf "%s | " | |
| let dispose (d:#IDisposable) = d.Dispose() |
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
| (* | |
| Heterogeneous Parallel Async Composition Operator | |
| - an evolution of http://jackfoxy.com/transparent-heterogeneous-parallel-async-with-fsharp/ | |
| *) | |
| type 'T Parallel = | |
| private { | |
| Compute : obj Async [] | |
| Unpack : obj [] -> int -> 'T | |
| } |
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
| open System.Reflection | |
| open System.Reflection.Emit | |
| open System.Runtime.InteropServices | |
| open System | |
| [<AutoOpen>] | |
| module ByteUtils = | |
| type Bit = | |
| | One |
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
| let construct_toml (toplevel:(string*Value)list, | |
| tables:(string*(string*Value)list)[]) = | |
| let addSection (table:Dictionary<string,Value>) (kvps:(string*Value) list) = | |
| kvps |> List.iter (fun (k,v)-> table.Add( keyName k,v )) | |
| let foldtoml (prev:string, nested:string list, acc:Dictionary<string,Value>,toml:Dictionary<string,Value>) | |
| (cur:string, elems:(string*Value)list) = | |
| try | |
| (* add parsed elements to current table *) |
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
| open System | |
| open System.Reflection | |
| type CLIArguments = | |
| | Working_Directory of string | |
| | Listener of host:string * port:int | |
| | Data of byte [] | |
| | Port of int | |
| | Log_Level of int | |
| | Detach |
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/fparsec/lib/net40-client/fparseccs.dll" | |
| #r "../../../packages/fparsec/lib/net40-client/fparsec.dll" | |
| open System | |
| Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ | |
| open FParsec | |
| open FParsec.Primitives | |
| let (^) = (<|) |
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
| open System.Diagnostics | |
| open System.Reflection | |
| open Microsoft.FSharp.Core | |
| open Microsoft.FSharp.Core.Operators | |
| open Microsoft.FSharp.Core.LanguagePrimitives | |
| open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators | |
| open Microsoft.FSharp.Collections | |
| open Microsoft.FSharp.Primitives.Basics | |
| open System.Collections.Generic |
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
| # NOTE - If there are weird character errors when trying to load this profile | |
| # resave the file with the encoding `UTF-8 with BOM` | |
| # ┌ ┐ | |
| # Setup Environment | |
| # └ ┘ | |
| # change to codepage to display symbols properly | |
| chcp 65001 | out-null |