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 Promise = | |
| open System.Threading.Tasks | |
| type Promise<'a> = {signal: 'a -> bool; | |
| future : Async<'a>; | |
| cancel : unit -> bool} | |
| let create<'a> () = | |
| let tcs = new TaskCompletionSource<'a>() | |
| let ta: Async<'a> = Async.AwaitTask tcs.Task | |
| {signal = tcs.TrySetResult; | |
| future = ta; | 
  
    
      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 | |
| module AsyncExt = | |
| open System.Threading | |
| let choice workflows = | |
| Async.FromContinuations(fun (cont, _, _) -> | |
| let cts = new CancellationTokenSource() | |
| let completed = ref false | |
| let lockObj = new obj() | |
| let synchronized f = lock lockObj f | 
  
    
      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 OptionBuilder() = | |
| member x.Bind(v,f) = Option.bind f v | |
| member x.Return v = Some v | |
| member x.ReturnFrom o = o | |
| let opt = OptionBuilder() | |
| //Clojure reducers | |
| let reduceSeq reducingF start ss = | |
| let mutable acc = start | 
  
    
      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
    
  
  
    
  | namespace test | |
| module Reducer = | |
| open System | |
| open System.Text | |
| open System.Collections.Generic | |
| open System.Linq | |
| open System.Threading.Tasks | |
| type ReduceFunc<'T,'R> = 'R -> 'T -> 'R | 
  
    
      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
    
  
  
    
  | //output | |
| //good keys | |
| //struct custom 1.506934 sec 0.000000 collisions | |
| //struct auto 4.832881 sec 0.776863 collisions | |
| //struct auto explicit 3.166931 sec 0.776863 collisions | |
| //bad keys | |
| //struct custom 3.631251 sec 0.061893 collisions | |
| //struct auto 10.340693 sec 0.777034 collisions | |
| //struct auto explicit 8.893612 sec 0.777034 collisions | 
  
    
      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; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text.RegularExpressions; | |
| namespace ConsoleApplication4{ | |
| class Program{ | |
| static string text = @"Functional programming is like describing your problem to a | |
| mathematician. Imperative programming is like giving instructions to | |
| an idiot. | |
| -- arcus, #scheme on Freenode"; | 
  
    
      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; | |
| using System.Collections.Generic; | |
| using System.Linq.Expressions; | |
| using Newtonsoft.Json; | |
| using System.Reflection; | |
| using System.IO; | |
| using System.ComponentModel; | |
| using System.Globalization; | 
  
    
      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; | |
| using System.Collections.Generic; | |
| using System.Linq.Expressions; | |
| using Newtonsoft.Json; | |
| using System.Reflection; | |
| using System.IO; | |
| using System.ComponentModel; | |
| using System.Globalization; | 
  
    
      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; | |
| using System.Collections.Generic; | |
| namespace HK | |
| { | |
| public class ForallSample | |
| { | |
| // this is simplified example to show the idea | |
| // we dont really need forall here | |
| // but in case of two input and output values with different types we need it | 
  
    
      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; | |
| using System.Collections.Generic; | |
| namespace HK | |
| { | |
| public class Forall{} | |
| public interface IGeneric<T, TCONTAINER> | |
| { | |
| } |