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
module Tree = struct | |
type z = Z : z | |
type 'a s = S : 'a s | |
type (_,_,_) max = | |
| MaxEq : 'a -> ('a,'a,'a) max | |
| MaxSuc : ('a, 'b, 'a) max -> ('a s, 'b, 'a s) max | |
| MaxFlip : ('a, 'b, 'c) max -> ('b, 'a, 'c) max |
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
#if !INTERACTIVE | |
module Program | |
#endif | |
open BenchmarkDotNet.Diagnostics.Windows | |
open BenchmarkDotNet.Attributes | |
open BenchmarkDotNet | |
open BenchmarkDotNet.Running | |
open Hyperion.ValueSerializers |
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.Collections.Generic | |
open System | |
type Notifications<'key, 'item> = | |
| Add of addKey : 'key * addItem : 'item | |
| Update of updateKey : 'key * updateItem : 'item | |
| Remove of removeKey : 'key | |
| RemoveAll |
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
type ISupervisedMailboxProcessor = | |
abstract Restart : unit -> unit | |
abstract AddChild : ISupervisedMailboxProcessor -> unit | |
type 'a Message = | |
| Message of 'a | |
| Restart | |
| AddActor of ISupervisedMailboxProcessor | |
exception RestartException |
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
type Op = | |
| Add of (Op * Op) | |
| Mul of (Op * Op) | |
| Divide of (Op * Op) | |
| Substract of (Op * Op) | |
| Value of int | |
let mul a b = Mul (a, b) | |
let sub a b = Substract (a, b) | |
let v = Value |
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
type Value = | |
| VInt of int | |
| VStr of string | |
type Id = Id of string | |
type Filter = | |
| All of Filter list | |
| Any of Filter list |
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.Threading | |
open System.Collections.Concurrent | |
type ThreadPool () = | |
let jobs = System.Collections.Concurrent.ConcurrentQueue<unit->unit> () | |
let semaphore = new Semaphore (0, System.Int32.MaxValue) | |
let threads = ConcurrentBag<Thread>() | |
let postJob job = | |
jobs.Enqueue job | |
semaphore.Release () |> ignore |
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
using System; | |
public static class Sort { | |
public static void quicksort(Span<int> arr){ | |
void swap(Span<int> s, int i, int j){ | |
var tmp = s[i]; | |
s[i] = s[j]; | |
s[j] = tmp; | |
} | |
int partition(Span<int> s) { |
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
type Char = uint8 | |
type Code = uint32 | |
let compress (init_map : Map<Char list, Code>) (text:string) : Code list option= | |
let rec compress acc (text:Char list) maybeCode (map:Map<_,_>) : Code list option= | |
match text with | |
| c::cs -> | |
let currCode = c::acc | |
match map.TryFind currCode with | |
| Some code_for_current_key -> compress currCode cs (Some code_for_current_key) map |
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
using System; | |
namespace FizzBuzz | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
for(int i=1;i<=100;i++) { | |
switch (new { mod3 = i % 3, mod5 = i % 5 }) { |
NewerOlder